当我打开 SSL(无 SSL 握手)时,Tomcat 7 没有响应

当我打开 SSL(无 SSL 握手)时,Tomcat 7 没有响应

我的问题是:为什么当我打开SSL时tomcat没有响应?

我尝试将正在运行的 tomcat7 Web 应用程序从 Ubuntu 12.10 x64 服务器迁移到全新的 Ubuntu 14.04 x64 服务器。已尽一切努力使两台机器之间的配置保持相同。

端口 80 上一切运行良好。当我编辑 server.xml 文件以启用 SSL 连接器时,我停止从服务器获取响应。我可以打开连接,但它只是挂在那里。例如,我可以 telnet 到端口 443,我可以发送“GET /”命令,但没有响应。服务器没有尝试 SSL 握手。

catalina.out 中没有错误,事实上我可以看到 SSL 协议处理程序的成功消息:

Feb 13, 2015 10:28:49 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-443"]

我已经通过使用 keytool 命令列出内容来验证密钥库文件是否有效。密钥库只是旧服务器的副本,因此我认为证书或其他方面不会出现任何问题。密钥库上的文件权限应该没有问题,我甚至尝试过 chmod 777,但行为没有任何变化。

这是我的 server.xml 连接器。同样,server.xml 是之前 Ubuntu 12 服务器的精确副本,所以我认为问题出在其他地方。

<Connector port="443" SSLEnabled="true" protocol="HTTP/1.1"
           maxThreads="150" scheme="https" secure="true"
           clientAuth="false" sslProtocol="TLS"
           keystoreFile="/var/lib/mywebapp/mywebapp.keystore"
           keystorePass="xxxxxxxx"/> 

我试图在这里明确设置协议,并且尝试了所有三个可用的值:

org.apache.coyote.http11.Http11Protocol-结果相同

org.apache.coyote.http11.Http11NioProtocol-结果相同

org.apache.coyote.http11.Http11AprProtocol - 异常是 APR/native 库不可用

tomcat版本信息:

Using CATALINA_BASE:   /usr/share/tomcat7
Using CATALINA_HOME:   /usr/share/tomcat7
Using CATALINA_TMPDIR: /usr/share/tomcat7/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
Server version: Apache Tomcat/7.0.52 (Ubuntu)
Server built:   Jul 24 2014 08:38:51
Server number:  7.0.52.0
OS Name:        Linux
OS Version:     3.13.0-37-generic
Architecture:   amd64
JVM Version:    1.7.0_71-b14
JVM Vendor:     Oracle Corporation

答案1

问题在于 Tomcat 正在等待熵。要解决此问题,请向 JVM 添加以下参数:

-Djava.security.egd=file:/dev/./urandom

相关内容