【转载】启动tomcat时,一直卡在Deploying web application directory这块的解决方案 有更新!

  zyw090111

1、现象

Tomcat在启动时一直卡在Deploying web application directory这句日志上,日志如下:

[root@iz8vbdzx7y7owm488t4d89z bin]# tail -f ../logs/catalina.out
09-Jun-2017 15:57:06.666 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
09-Jun-2017 15:57:06.667 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
09-Jun-2017 15:57:06.667 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 535 ms
09-Jun-2017 15:57:06.684 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
09-Jun-2017 15:57:06.684 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.15
09-Jun-2017 15:57:06.690 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/apache-tomcat-8.0.15-server/webapps/ROOT

2、产生原因

linux或者部分unix系统提供随机数设备是/dev/random 和/dev/urandom ,两个有区别,urandom安全性没有random高,但random需要时间间隔生成随机数。jdk默认调用random。

3、解决办法

找到jdk1.x.x_xx/jre/lib/security/java.security文件,在文件中找到securerandom.source这个设置项,
将其改为:securerandom.source=file:/dev/./urandom

原文链接http://blog.csdn.net/njchenyi/article/details/46641141