当我在Eclipse中启动我的Tomcat时,我收到以下错误:
PM org.apache.catalina.startup.SetAllPropertiesRule begin
WARNUNG: [SetAllPropertiesRule]{Server/Service/Connector/SSLHostConfig/Certificate} Setting property 'keystorePass' to 'mypassword' did not find a matching property.
我正在使用Tomcat 9.0.6。 我使用以下命令
使用jdk1.8.0_66生成了我的密钥库文件keytool.exe -genkey -alias tomcat -keyalg RSA -keystore c:\tomcatkeystore
我已使用
验证了密码的正确性keytool.exe -list -keystore c:\tomcatkeystore
我已将连接器添加到server.xml
<Connector SSLEnabled="true" maxThreads="150" port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol">
<SSLHostConfig>
<Certificate certificateKeystoreFile="c:\tomcatkeystore"
keystorePass="mypassword"
type="RSA"/>
</SSLHostConfig>
</Connector>
Stacktrace:
Failed to initialize component [Connector[HTTP/1.1-8443]]
org.apache.catalina.LifecycleException: Protocol handler initialization failed
at org.apache.catalina.connector.Connector.initInternal(Connector.java:935)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:530)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:852)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
at org.apache.catalina.startup.Catalina.load(Catalina.java:633)
at org.apache.catalina.startup.Catalina.load(Catalina.java:656)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:309)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
Caused by: java.lang.IllegalArgumentException: Keystore was tampered with, or password was incorrect
at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:114)
at org.apache.tomcat.util.net.AbstractJsseEndpoint.initialiseSsl(AbstractJsseEndpoint.java:85)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:216)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1043)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:540)
at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:74)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:932)
... 13 more
Caused by: java.io.IOException: Keystore was tampered with, or password was incorrect
at sun.security.provider.JavaKeyStore.engineLoad(Unknown Source)
at sun.security.provider.JavaKeyStore$JKS.engineLoad(Unknown Source)
at sun.security.provider.KeyStoreDelegator.engineLoad(Unknown Source)
at sun.security.provider.JavaKeyStore$DualFormatJKS.engineLoad(Unknown Source)
at java.security.KeyStore.load(Unknown Source)
at org.apache.tomcat.util.net.SSLUtilBase.getStore(SSLUtilBase.java:139)
at org.apache.tomcat.util.net.SSLHostConfigCertificate.getCertificateKeystore(SSLHostConfigCertificate.java:204)
at org.apache.tomcat.util.net.jsse.JSSEUtil.getKeyManagers(JSSEUtil.java:184)
at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:112)
... 19 more
Caused by: java.security.UnrecoverableKeyException: Password verification failed
... 28 more
问题是:为什么我会收到该错误消息或为什么Tomcat无法正确处理密码或密钥库?
更新:当我为我的密钥库使用Tomcat的默认密码“changeit”并从我的连接器中删除“keystorePass”属性时,它可以工作。 对于更新,另一个问题出现了: 密钥库使用密码“changeit”是否安全?
答案 0 :(得分:0)
我认为这可能有效:
certificateKeystorePassword='mypassword'
由于certificateKeystorePassword
中有错字,我也收到了类似的错误消息。