Reputation: 2047
I work with apach tomcat 7
I used this kind of command in order to use ssl
keytool -genkey -alias tomcat -keypass changeit -keyalg RSA
keytool -export -alias tomcat -keypass changeit -file server.cert
keytool -import -alias tomcat -file %FILE_NAME% -keypass changeit -keystore %JAVA_HOME%/jre/lib/security/cacerts
in web.xml of tomcat server
I add this code :
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="C:\key\server.cert"
keystorePass="changeit"
/>
but when I try to start my server I have this error :
SEVERE: Failed to initialize end point associated with ProtocolHandler ["http-bio-8443"]
java.io.IOException: Invalid keystore format
at sun.security.provider.JavaKeyStore.engineLoad(Unknown Source)
at sun.security.provider.JavaKeyStore$JKS.engineLoad(Unknown Source)
Upvotes: 1
Views: 28936
Reputation: 481
If you want to import the server.cert file into the cacerts file available in the jre lib, you can modify the command as below and try.
keytool -import -alias tomcat -keystore %JAVA_HOME%/jre/lib/security/cacerts -keypass changeit -file server.cert
Once given, it will ask for the keystore password and to Re-enter the same. Then give yes to confirm to trust that certificate file.
It works fine for me.
Upvotes: 1