Solution to Java program unable to find valid certification path to requested target

On macOS sierra, some Java program encountered error: 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

Popular google answer suggested to use keytool to add certificate to $JAVA_HOME/jre/lib/security/cacerts.This solution probably works on other OS like Ubuntu, but it does not work on macOS sierra. I still got such error after adding certificate to $JAVA_HOME.

The root cause is that the application in trouble does not refer to $JAVA_HOME/jre/lib/security/cacerts, but refer to a file in its own installation path like /Applications/ccollab_client/.install4j/jre.bundle/Contents/Home/jre/lib/security/cacerts. After I added certificate to this place, ccollab software works without problem.

Do a search, we’ll find a few cacerts file outside of $JAVA_HOME.

sudo find / -name cacerts -type f

like /Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/itms/java/lib/security/cacerts

Advertisements
This entry was posted in Java, Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s