javax.net.ssl.SSLHandshakeException: PKIX path building failed: unable to find valid certification path to requested target
Java doesn’t trust the server’s certificate chain (self-signed, corporate proxy CA, or missing intermediate).
PKIX path building failedunable to find valid certification path to requested target Meaning
The JVM uses its own truststore (cacerts), not the OS one. Corporate SSL inspection and internal CAs must be imported into the JDK’s truststore.
Common causes
- Self-signed/internal CA certificate
- Corporate proxy re-signing HTTPS
- Server missing intermediate certificates
- Old JDK without newer root CAs
⚡ Quick fix
- Import the CA into the JDK truststore with keytool
- Fix the server chain
- Update the JDK
Detailed fix by platform
Java
keytool -importcert -alias corp-root -file corp-root.pem -keystore "$JAVA_HOME/lib/security/cacerts" -storepass changeit
How to diagnose
- Chain — openssl s_client output
- Truststore — Which JDK/cacerts is used?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Java
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 15 Oct 2026