Why is my Java app unable to find a valid certification path?

Issue

I see the 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

Resolution

This indicates the Java keystore file on your dyno does not have the necessary certificates needed to trust a service you are invoking.

You can customize the keystore by creating a JDK overlay as described in Customizing the JDK on Dev Center.

Very often you can use the cacerts in your local JDK installation at $JAVA_HOME/jre/lib/security/cacerts or $JAVA_HOME/lib/security/cacerts, depending on your JDK version.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support