Tomcat SSL - IllegalStateException:SSL会话ID不可用

时间:2016-07-04 06:55:41

标签: tomcat ssl spring-security

我正在开发项目 - Tomcat 9,JSF 2.2,Spring Security 4.1

当我尝试使用HTTPS SSL保护连接时,当我访问页面时出现错误但HTTPS运行良好。只有这个错误让我发疯。

02-Jul-2016 16:02:04.664 WARNING [https-openssl-nio-443-exec-1] org.apache.coyote.http11.Http11Processor.action Exception getting SSL attributes
java.lang.IllegalStateException: SSL session ID not available
 at org.apache.tomcat.util.net.openssl.OpenSSLEngine$OpenSSLSession.getId(OpenSSLEngine.java:1048)
 at org.apache.tomcat.util.net.jsse.JSSESupport.getSessionId(JSSESupport.java:156)
 at org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:806)
 at org.apache.coyote.Request.action(Request.java:392)
 at org.apache.catalina.connector.Request.getAttribute(Request.java:903)
 at org.apache.catalina.connector.Request.getAttributeNames(Request.java:985)
 at com.sun.faces.application.WebappLifecycleListener.requestDestroyed(WebappLifecycleListener.java:114)
 at com.sun.faces.config.ConfigureListener.requestDestroyed(ConfigureListener.java:383)
 at org.apache.catalina.core.StandardContext.fireRequestDestroyEvent(StandardContext.java:5953)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
 at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
 at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1110)
 at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
 at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:785)
 at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1419)
 at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:44)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
 at java.lang.Thread.run(Thread.java:745)

奇怪的是,我的队友没有收到此错误,他有相同的代码,服务器和服务器设置。

Tomcat HTTPS设置:

    <Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
      SSLEnabled="true"
      maxThreads="150"
      scheme="https" secure="true"          
      clientAuth="false" sslProtocol="TLSv1.2"
      keystoreFile="C:\apache-tomcat-9.0.0.M8\conf\keystore"
      keystorePass="changeit" 
      keyAlias="tomcat" 
      keyPass="????" />

抱歉我的英文。

1 个答案:

答案 0 :(得分:4)

我怀疑你的队友没有安装Tomcat Native库。

这是启用TLS会话票证的副作用。如果您在disableSessionTickets="true"上设置SSLHostConfig,则会看到TLS会话ID,错误就会消失。

您在启用会话票证时看到异常,这看起来是Tomcat使用OpenSSL代码的JSSE中的错误。我已经为Tomcat Native打开了一个错误:

https://bz.apache.org/bugzilla/show_bug.cgi?id=59811

您可以通过错误跟踪进度。