在tomcat中应用SSL证书时出错

时间:2016-10-18 11:32:06

标签: java tomcat ssl

我从https://www.gogetssl.com/ggssl/购买了SSL证书。

我的tomcat版本 -

Using CATALINA_BASE:   /home/ec2-user/apache-tomcat-8.0.36
Using CATALINA_HOME:   /home/ec2-user/apache-tomcat-8.0.36
Using CATALINA_TMPDIR: /home/ec2-user/apache-tomcat-8.0.36/temp
Using JRE_HOME:        /usr/lib/jvm/jre
Using CLASSPATH:       /home/ec2-user/apache-tomcat-8.0.36/bin/bootstrap.jar:/home/ec2-user/apache-tomcat-8.0.36/bin/tomcat-juli.jar
Server version: Apache Tomcat/8.0.36
Server built:   Jun 9 2016 13:55:50 UTC
Server number:  8.0.36.0
OS Name:        Linux
OS Version:     4.4.5-15.26.amzn1.x86_64
Architecture:   amd64
JVM Version:    1.7.0_99-mockbuild_2016_03_28_23_53-b00
JVM Vendor:     Oracle Corporation

收到SSL证书后,我已将其添加到我的密钥库中 -

keytool7 -list -keystore /home/ec2-user/myweb.jks 
Enter keystore password:  

Keystore type: JKS
Keystore provider: SUN

Your keystore contains 1 entry

server, Oct 18, 2016, trustedCertEntry, 
Certificate fingerprint (SHA1): 3D:3A:2A:59:C7:4C:78:1B:38:0F:3E:FF:77:86:44:D5:59:6A:5B:FD

我在server.xml中做了如下更改:

<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
           maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
           clientAuth="false" sslProtocol="TLS" keyAlias="server" 
    keystoreFile="/home/ec2-user/myweb.jks" keystorePass="XXXXXX" />

重启我的tomcat实例后,服务器抛出错误:

18-Oct-2016 08:37:24.858 SEVERE [main] org.apache.coyote.AbstractProtocol.init Failed to initialize end point associated with ProtocolHandler ["http-nio-8443"]
 java.io.IOException: Alias name server does not identify a key entry
        at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESocketFactory.java:608)
        at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESocketFactory.java:546)
        at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:371)
        at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:748)
        at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:459)
        at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:120)
        at org.apache.catalina.connector.Connector.initInternal(Connector.java:960)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
        at org.apache.catalina.core.StandardService.initInternal(StandardService.java:568)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
        at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:869)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:580)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:603)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:310)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:484)

18-Oct-2016 08:37:24.859 SEVERE [main] org.apache.catalina.core.StandardService.initInternal Failed to initialize connector [Connector[HTTP/1.1-8443]]
 org.apache.catalina.LifecycleException: Failed to initialize component [Connector[HTTP/1.1-8443]]
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
        at org.apache.catalina.core.StandardService.initInternal(StandardService.java:568)
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
        at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:869)

请帮我解决这个问题?

由于 彩

0 个答案:

没有答案