• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

No trusted certificate found

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic