新部署的項目啓動tomcat後一直停在org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.16,卡在了org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/opt/tomcat/webapps/host-manager]
將近7分鐘。java
[root@app-web-2-64-0002 bin]# tail -500f ../logs/catalina.2018-07-04.out ...... 04-Jul-2018 16:28:59.520 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 328 ms 04-Jul-2018 16:28:59.534 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina] 04-Jul-2018 16:28:59.534 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.16 ...... 卡了近7分鐘 ...... 04-Jul-2018 16:35:00.238 WARNING [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [360,548] milliseconds. 04-Jul-2018 16:35:00.273 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/opt/tomcat/webapps/host-manager] ....
解決方法:
修改jdk的java.security文件securerandom.source項linux
[root@app-web-2-64-0002 bin]# grep "source=file" /usr/java/jdk1.8.0_161/jre/lib/security/java.security #securerandom.source=file:/dev/random securerandom.source=file:/dev/./urandom [root@app-web-2-64-0002 bin]#
將securerandom.source=file:/dev/random修改成securerandom.source=file:/dev/./urandomweb
linux或者部分unix系統提供隨機數設備是/dev/random 和/dev/urandom ,兩個有區別,urandom安全性沒有random高,但random須要時間間隔生成隨機數。jdk默認調用random。可經過 head -n 1 /devrandom 查看是否的系統會出現僞隨機數提供等待,apache