码迷,mamicode.com
首页 > 其他好文 > 详细

配置CAS错误No Certificate file specified or invalid file format

时间:2015-03-03 16:33:24      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:

配置tomcat证书 keystore文件后启动一直报错:(tomcat版本:apache-tomcat-6.0.43)

tomcat配置:

    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
           maxThreads="150" scheme="https" secure="true"
           clientAuth="false" sslProtocol="TLS"
           keystoreFile="conf/tomcat.keystore"
           keystorePass="123456" />
tomcat.keystore所在位置:

技术分享

错误信息:
严重: Error initializing endpoint
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:836)
    at org.apache.coyote.http11.Http11AprProtocol.init(Http11AprProtocol.java:109)
    at org.apache.catalina.connector.Connector.initialize(Connector.java:1123)
    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)
2015-3-3 16:05:52 org.apache.catalina.core.StandardService initialize
严重: Failed to initialize connector [Connector[HTTP/1.1-8443]]
LifecycleException:  Protocol handler initialization failed: java.lang.Exception: No Certificate file specified or invalid file format
    at org.apache.catalina.connector.Connector.initialize(Connector.java:1125)
    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版本号ssl的配置有所不同,你用的如果是tomcat6.0的话:

<Connector protocol="org.apache.coyote.http11.Http11NioProtocol" port="8443" minSpareThreads="5" 
maxSpareThreads="75"enableLookups="true" disableUploadTimeout="true" acceptCount="100" maxThreads="200" 
scheme="https" secure="true"SSLEnabled="true" clientAuth="false" sslProtocol="TLS" 
keystoreFile="F:/apache-tomcat/server.keystore" keystorePass="password"/>


所以把配置文件改为
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" SSLEnabled="true"
           maxThreads="150" scheme="https" secure="true"
           clientAuth="false" sslProtocol="TLS"
           keystoreFile="conf/tomcat.keystore"
           keystorePass="123456" />

问题就解决了。

 

值得一提的是tomcat也是误人子弟啊,server.xml中注释的样例配置就是

protocol="HTTP/1.1"
    <!--
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->
实在是太坑爹了!!!


配置CAS错误No Certificate file specified or invalid file format

标签:

原文地址:http://www.cnblogs.com/andong2015/p/4311253.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!