2012-05-11 75 views
6

为了在tomcat中支持ssl ....我创建一个密钥库文件。包含自签名证书.....和Tomcat的7.0然后打开server.xml文件并在server.xml中在tomcat 7.0中配置tomcat以支持ssl的问题

`  <!-- Define a SSL HTTP/1.1 Connector on port 8443 
    This connector uses the JSSE configuration, when using APR, the 
    connector should be using the OpenSSL style configuration 
    described in the APR documentation --> 

    <!-- <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" 
      maxThreads="150" scheme="https" secure="true" 
      clientAuth="false" sslProtocol="TLS" /> --> ` 

找到该代码,并从连接器上取下评论,并把KeystoreFile进入和KeystorePass条目像下面这样注释掉连接器代码.........

` <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" 
     maxThreads="150" scheme="https" secure="true" 
     clientAuth="false" sslProtocol="TLS" **keystoreFile**="d:\cpademo.keystore" 
    **keystorePass**="cpademo"/>  ` 

The above code works in tomcat 6.0...and allow https connection with tomcat but i get the error in tomcat 7.0 log file which indicate that it does not suppoert connection to https 8443 connection. Error in log file is following as..... 

ERROR: 

SEVERE: Failed to initialize end point associated with ProtocolHandler ["http-ap 
r-8443"] 
java.lang.Exception: Connector attribute SSLCertificateFile must be defined when 
using SSL with APR 
    at org.apache.tomcat.util.net.AprEndpoint.bind(AprEndpoint.java:484) 
    at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:554) 

请帮助我理清这个问题。提前Thanx

+1

SO的离题;属于[sf] –

回答

14

您正在使用带JSSE连接器(BIO和NIO)的SSL配置的APR /本机连接器。最简单的解决方法是在server.xml中注释掉APR生命周期侦听器。

+1

您可能还需要在Apache Tomcat 7中使用'keyPass'来代替(或除此之外)'keystorePass'。 – Bruno