Friday, March 04, 2011

Setting javax.net.ssl.trustStore in JDev

While running an application deployed to my integrated WLS instance, I was seeing this error:

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

And trying to solve it using the program attached to this post.

Unfortunately when I'd run it, instead of seeing the same error as above, I'd see this:

No errors, certificate is already trusted

And here's why: I noticed when JDeveloper started up WLS, it was setting

javax.net.ssl.trustStore=%OH%/Middleware/wlserver_10.3/server/lib/DemoTrust.jks

But when I ran InstallCert, it was instead referencing a keystore that does contain the certificate I need

%OH%/Middleware/jdk160_21/jre/lib/security/cacerts

It turns out that in JDev preferences, setting Client Trusted Certificate Keystore will change the value of javax.net.ssl.trustStore. A quick restart of WLS and your app is working great!

No comments: