4

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?

Dineshkumar
  • 1,468
  • 4
  • 22
  • 49

3 Answers3

5

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

Community
  • 1
  • 1
justin.hughey
  • 1,246
  • 15
  • 16
1

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

Akanksha gore
  • 558
  • 1
  • 8
  • 7
0

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

Prakash Palnati
  • 3,231
  • 22
  • 35