Configure Tomcat to use a trust store other than cacerts
I'm running Tomcat 6 on Windows and would like to have Tomcat use a different trust store other than cacerts for Java client web requests. I've tried adding this setting:
-Djavax.net.ssl.trustStore="C:\ca.keystore"
To the registry in key:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\Tomcat6\Parameters\J开发者_Go百科ava
That doesn't seem to work though. It still uses the JRE cacerts store. Our Java code makes web requests to HTTPS endpoints and I would like to keep the certificates in a key store other than the JRE one because it gets removed when java is uninstalled/updated.
Turns out I was missing trustStorePassword
. Here is the solution:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\Tomcat6\Parameters\Java
-Djavax.net.ssl.trustStore="C:\ca.keystore"
-Djavax.net.ssl.trustStorePassword="password"
Update: There seems to be some confusion in some of the comments here between what this setting and truststoreFile
from server.xml
do. I created a blog entry to explain the problem (in great detail) and how this solution addresses it and why the changing server.xml
does not.
精彩评论