Interview Prep/Networking/TLS and certificate errors

Java client fails with `PKIX path building failed: unable to find valid certification path to requested target`.

IntermediateTroubleshootingTLS and certificate errors
Answer

Likely causes → The JVM truststore (cacerts) lacks the issuing CA, the server sends an incomplete chain, or the app uses a custom truststore that overrides defaults.

Diagnose →

keytool -list -cacerts -storepass changeit | grep -i myca
java -Djavax.net.debug=ssl:handshake -jar app.jar 2>&1 | grep -i -A3 'certificate'

Fix → Import the CA: keytool -importcert -cacerts -storepass changeit -alias myca -file myca.crt -noprompt, or fix the server chain.

Prevent → Build images with the CA imported; check -Djavax.net.ssl.trustStore overrides.

All Networking questions Roadmap: Networking for DevOps

More on TLS and certificate errors