java org.apache.catalina.LifecycleException:无法初始化组件 [连接器 [HTTP/1.1-8443]]

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28009635/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 12:48:56  来源:igfitidea点击:

org.apache.catalina.LifecycleException: Failed to initialize component [Connector[HTTP/1.1-8443]]

javassltomcat7keystore

提问by franco

I work with apach tomcat 7

我使用 apach tomcat 7

I used this kind of command in order to use ssl

我使用这种命令是为了使用 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

在tomcat服务器的web.xml中

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)

回答by Nivetha T

If you want to import the server.certfile into the cacertsfile available in the jre lib, you can modify the command as below and try.

如果要将server.cert文件导入jre 库中可用的cacerts文件中,可以修改如下命令并尝试。

keytool -import -alias tomcat -keystore %JAVA_HOME%/jre/lib/security/cacerts -keypass changeit -file server.cert

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.

一旦给出,它将要求输入密钥库密码并重新输入相同的密码。然后给出 yes 以确认信任该证书文件。

It works fine for me.

这对我来说可以。