Saturday, August 18, 2007

javax.net.ssl.SSLHandshakeException

If you see collowing exception, while accessing HTTPS URL from java code.
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
Then most likely the URL you are accessing doesn't have certificate signed by a CA, and you need to install this certificate manually. Use keytool to import the certificate to a keystore (lets name this as mykeystore and you put this in /etc/keystoers dir) and then start your java application with following parameter -Djavax.net.ssl.trustStore=/etc/keystores/mykeystore.

No comments: