1:原来的配置是
1 <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" 2 maxThreads="150" scheme="https" secure="true" 3 clientAuth="false" sslProtocol="TLS" keystoreFile="conf/.keystore" keystorePass="123456"/>
2:保存配置,启动服务器,报如下异常:
java.lang.Exception: No Certificate file specified or invalid file format
at org.apache.tomcat.jni.SSLContext.setCertificate(Native Method)
at org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:835)
at org.apache.coyote.http11.Http11AprProtocol.init(Http11AprProtocol.java:109)
at org.apache.catalina.connector.Connector.initialize(Connector.java:1141)
at org.apache.catalina.core.StandardService.initialize(StandardService.java:703)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:843)
at org.apache.catalina.startup.Catalina.load(Catalina.java:538)
at org.apache.catalina.startup.Catalina.load(Catalina.java:562)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
原因:tomcat版本问题,我用的是tomcat6_45版本,默认使用apr协议,解决办法:
配置修改为:
1 <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true" 2 maxThreads="150" scheme="https" secure="true" 3 clientAuth="false" sslProtocol="TLS" keystoreFile="conf/.keystore" keystorePass="123456"/>
再次重启服务器,就没有问题了。