PKIX path building Failed error while establishing SSL connection

169 Views Asked by At

I was trying to establish a ssl connection to the sever in my application. for this, I generated self-signed certificates and added them to the keystore as well as the java cacerts which is the trust store.

But When I launch my application, I keep getting PKIX path building failed validatorException: unable to find valid path to requested target error

Hence unable to login to my java application.I use java1.8.0_144 version.

2

There are 2 best solutions below

1
On

Try to login to the website which IDE is complaining about, and see if you are able to access it through the browser. If so, then check for the certificate being used in the browser and check that certificate is present in your java cacerts.

0
On

Hi i usually generated the root CA with openssl and never worked importing that into the cacerts with keytools. You can instead generate it with this application i made out of desperation (it's a Java 11 app):

https://github.com/kendarorg/JavaCaCertGenerator

Its only purpose is to replace the generation of the private key and the root certificate, in a form "fit" for cacerts. From there you can produce the various certificates for the addresses