论坛首页 Java企业应用论坛

Error initializing endpoint java.io.IOException: Invalid keystore format

浏览 8987 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2009-12-23   最后修改:2009-12-25
最近在研究cas,在服务器上运行:

keytool -genkey -alias tomcat-server -keyalg RSA -keypass changeit -storepass changeit -validity 3600


在/root目录下生成.keystore文件

tomcat配置为:
<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="/root/.keystore"    
              keystorePass="changeit"/>

启动tomcat,抛如下异常:
严重: Error initializing endpoint
java.io.IOException: Invalid keystore format
        at sun.security.provider.JavaKeyStore.engineLoad(Unknown Source)
        at sun.security.provider.JavaKeyStore$JKS.engineLoad(Unknown Source)
        at java.security.KeyStore.load(Unknown Source)
        at org.apache.tomcat.util.net.NioEndpoint.init(NioEndpoint.java:804)
        at org.apache.coyote.http11.Http11NioProtocol.init(Http11NioProtocol.java:136)
        at org.apache.catalina.connector.Connector.initialize(Connector.java:1058)
        at org.apache.catalina.core.StandardService.initialize(StandardService.java:677)
        at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:795)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:535)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:555)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:260)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:412)
2009-12-23 17:38:11 org.apache.catalina.startup.Catalina load
严重: Catalina.start
LifecycleException:  Protocol handler initialization failed: java.io.IOException: Invalid keystore format
        at org.apache.catalina.connector.Connector.initialize(Connector.java:1060)
        at org.apache.catalina.core.StandardService.initialize(StandardService.java:677)
        at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:795)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:535)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:555)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:260)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:412)
2009-12-23 17:38:11 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 465 ms
2009-12-23 17:38:11 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2009-12-23 17:38:11 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.20
2009-12-23 17:38:11 org.apache.catalina.core.StandardContext resourcesStart
严重: Error starting static Resources
java.lang.IllegalArgumentException: Document base /home/sswitch/web/tomcat/webapps/ROOT does not exist or is not a readable directory
        at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:142)
        at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4048)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4217)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at org.apache.catalina.core.StandardService.start(StandardService.java:516)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2009-12-23 17:38:11 org.apache.catalina.core.StandardContext start
严重: Error in resourceStart()
2009-12-23 17:38:11 org.apache.catalina.core.StandardContext start
严重: Error getConfigured
2009-12-23 17:38:11 org.apache.catalina.core.StandardContext start
严重: Context [] startup failed due to previous errors
2009-12-23 17:38:11 org.apache.catalina.core.StandardContext stop
信息: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/] has not been started
2009-12-23 17:38:12 org.apache.catalina.core.ApplicationContext log
信息: Initializing log4j from [classpath:log4j.properties]
2009-12-23 17:38:12 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
2009-12-23 17:38:13 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring FrameworkServlet 'cas'
2009-12-23 17:38:13 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-80
2009-12-23 17:38:13 org.apache.coyote.http11.Http11NioProtocol start
严重: Error starting endpoint
java.net.BindException: Address already in use
        at sun.nio.ch.Net.bind(Native Method)
        at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
        at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
        at org.apache.tomcat.util.net.NioEndpoint.init(NioEndpoint.java:782)
        at org.apache.tomcat.util.net.NioEndpoint.start(NioEndpoint.java:856)
        at org.apache.coyote.http11.Http11NioProtocol.start(Http11NioProtocol.java:167)
        at org.apache.catalina.connector.Connector.start(Connector.java:1131)
        at org.apache.catalina.core.StandardService.start(StandardService.java:531)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2009-12-23 17:38:13 org.apache.catalina.startup.Catalina start
严重: Catalina.start: 
LifecycleException:  service.getName(): "Catalina";  Protocol handler start failed: java.net.BindException: Address already in use
        at org.apache.catalina.connector.Connector.start(Connector.java:1138)
        at org.apache.catalina.core.StandardService.start(StandardService.java:531)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2009-12-23 17:38:13 org.apache.catalina.startup.Catalina start
信息: Server startup in 2041 ms


这个异常导致的原因是:生成.keystore证书的jre版本和tomcat所用的jre版本不一样。在/etc/profile下配置一下jdk路径,重新生成证书,问题解决。

论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics