I am trying to add some certs to my java cacerts file, but am consistently getting the error PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
, suggesting that the root certs (which I know are correct) are not being read properly.
The location where I'm adding the certs is ~/.sdkman/candidates/java/current/jre/lib/security/cacerts
. However, I just tried adding them to the specific current java version (which happens to be 8.0.372-amzn) at ~/.sdkman/candidates/java/8.0.372-amzn/jre/lib/security/cacerts
and now suddenly it's working without error.
My understanding had been that putting them in the java/current/
folder would apply to whatever version of java I was currently using, i.e. it would apply to all of my java versions. But evidently that's not the case.
I'd like to avoid having to manage certs in every individual java version this way, since we run several different apps that share the same root certs but use different versions of java, or may upgrade versions from time to time. Is there a way to get the java/current/
folder to behave the way I'm envisioning, or am I misunderstanding its purpose?