First of all, I must say I'm not a Java developer but a sys admin.
I thought when a Java process is launched with no javax.net.ssl.trustStore
and javax.net.ssl.keyStore
properties, the certificates in its $JAVA_HOME/jre/lib/security/cacerts
always are loaded and used.
But I have found that one JBoss war loads another keystore and ignore the certificates in the default cacerts.
The problem was a PKIX typical error message
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
but I was sure the certificate needed was in the default cacerts.
I had to put the property javax.net.debug=all
to shed some light on this issue and found that another keystore was loaded -- one having an old expired certificate, and which I didn't know.
After adding the valid certificate on the second keystore, the PKIX error message disappeared.
Then, how SSL certificates are dealed in a Java process?
When a new keystore is loaded, previously loaded certificates are deleted from memory?
Best regards