Embracing the Messiness in Search of Epic Solutions

Java + HTTPS: Unable to Find Valid Certification Path to Requested Target

Posted

in

PROBLEM

When trying to invoke HTTPS-based web service (ex: https://server:1234/myapp/web-service), the following exceptions occurred:-

Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException:
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target


Caused by: sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find
valid certification path to requested target

Caused by: sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target

SOLUTION

I do not want to take any credits away from @mkyong, but this author wrote a great solution to this problem at http://www.mkyong.com/webservices/jax-ws/suncertpathbuilderexception-unable-to-find-valid-certification-path-to-requested-target/ . Kudos to him.

The only thing I want to point out here is the link to InstallCert.java in his blog is dead, but you can download it from https://code.google.com/p/java-use-examples/source/browse/trunk/src/com/aw/ad/util/InstallCert.java .

The long story short here is to run java InstallCert server:1234 to generate a file called jssecacerts. Then, drop this file in ${JAVA_HOME}/lib/security directory.

Tags:

Comments

2 responses to “Java + HTTPS: Unable to Find Valid Certification Path to Requested Target”

  1. […] I found a fix for this error on this website: http://myshittycode.com/2014/06/05/java-https-unable-to-find-valid-certification-path-to-requested-t… […]

Leave a Reply