Hi,
Here is my url which I normally post thru internet explorer.
https://myco-finanace.com/fi/Servlets/Login?user=xyz&name=somename This url works 100% in Browser world. I get a certificate warning (its not trusted.. I installed it.. and I am fine).
Now I need to post this url thru a
java client. here is my code snippet:
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;
public class Test{
public static void main (
String[] args){
String urlString="https://myco-finanace.com/fi/Servlets/Login?user=xyz&name=somename";
try{
HttpClient client = new HttpClient();
PostMethod httpPost = new PostMethod(urlString);
client.executeMethod(httpPost);
}
catch (Exception ex){
ex.printStackTrace();
}
}
I get an exception
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
Further more... these are the steps I took to load the cert.
1. Exported the certficated from browser and saved as a file.
(Internet Explorer>>tools>Internet Options>>contents>>Certificate>>Trusted Root certification authority>> select the certificate I want to import to java client... save it as tmpCIB.cer). Copy this file in the D:\WebSphere5\AppServer\java\jre\lib\security folder.
2. D:\WebSphere5\AppServer\java\jre\bin/keytool -import -file tmpCIB.cer -trustcacerts -alias a1 -keystore D:\WebSphere5\AppServer\java\jre\lib\security/cacerts
To make sure it is loaded in the right place...
3.D:\WebSphere5\AppServer\java\jre\bin/keytool -list -alias a1 -keystore D:\WebSphere5\AppServer\java\jre\lib\security/cacerts
Mind you, my certifacte CN name is an IP address not a server DNS name.
Please Help. If you can be kind enough to send me an e-mail @
iindia@hotmail.com .. that would be great! Thanks!