javax.net.ssl.SSLHandshakeException:PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:

Tags: , , , ,



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

My spring boot application communicate to a remote https url and it gives the above mentioned error while hitting a POST request. I went through multiple stackoverflow posts for the same topic. Installed/imported required certificates using keytool and restarted JVM. But that didn’t resolve my issue. The error message is the same, however the root cause is different here apart from importing certs. Just wanted to post this as new question since I have been trying for last couple of days without any luck what so ever!

Answer

I figured out the issue was with JDK. Default Oracle version installed in the system added wrong JRE path to environment variable. I have pointed it to correct JDK version and imported certs there. That resolved the issue. Thank you very much for kind comments.



Source: stackoverflow