Dineshkumar
Dineshkumar

Reputation: 1548

"PKIX path building failed: unable to find valid certification path to requested target" Only in release version

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?

Upvotes: 6

Views: 95761

Answers (3)

Prakash Palnati
Prakash Palnati

Reputation: 3409

If you are using VPN or a forward proxy, you just need to add the certificate of your proxy to Java cacerts.

check this answer on how to do that. https://stackoverflow.com/a/9619478/4144572

Upvotes: 1

Akanksha gore
Akanksha gore

Reputation: 608

Definitely its problem with certificates. Thing that worked for me was, placing required certificate in C -> program files-> java -> jre -> lib -> security location. After pasting cerificate at this loaction, build successful

Upvotes: 1

justin.hughey
justin.hughey

Reputation: 1256

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..

Upvotes: 6

Related Questions