The issue is something tricky. I tried to connect my war file to a Active Directory via LDAPS. While running with Debug Mode from IntelliJ IDEA, the code is working perfectly fine.
When I Install the war files in same or different machine, am facing this error.
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
The certificates are self-signed. I have added the CA.crt in truststore.jks
, LDAP.cer in cacerts
. I also tried adding in the `jssecacerts', but same result.
Note: Am using Apache Shiro framework.
How to avoid this error? Why it is not coming in the debug mode?
This is not a Shiro problem. It is a problem with your certificates. I suspect your IDE may be using a different Java install than where your deployed WAR is executing from.
This exception has been handled previously How to ignore PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException?.
Also, I found this article useful PKIX path building failed: SunCertPathBuilderException: unable to find valid certification path to requested target..