环境信息:
CentOS release 6.8
tomcat-8.0
JDK1.8
一、启动tomcat
#sh /root/tomcat-8.0/bin/startup.sh
#tailf /root/tomcat-8.0/logs/catalina.out
-Aug- ::31.661 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
-Aug- ::31.662 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in ms
-Aug- ::31.685 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
-Aug- ::31.685 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.
-Aug- ::31.695 INFO [localhost-startStop-] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /root/tomcat-8.0/webapps/ROOT
-Aug- ::36.184 INFO [localhost-startStop-] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
-Aug- ::37.895 INFO [localhost-startStop-] java.util.prefs.FileSystemPreferences$.run Created system preferences directory in java.home.
-Aug- ::37.897 INFO [localhost-startStop-] java.util.prefs.FileSystemPreferences$.run Created user preferences directory.
-Aug- ::37.907 WARNING [localhost-startStop-] java.util.prefs.FileSystemPreferences$.run Prefs file removed in background /root/.java/.userPrefs/prefs.xml
-Aug- ::37.908 WARNING [localhost-startStop-] java.util.prefs.FileSystemPreferences$.run Prefs file removed in background /root/jdk-1.8/jre/.systemPrefs/prefs.xml
... ...
等待tomcat启动的过程是煎熬的,足足5/6分钟,在不抱希望的情况下它居然又启动完成了......
有两种解决办法:
1)在Tomcat环境中解决
在catalina.sh中加入这么一行:
-Djava.security.egd=file:/dev/./urandom
例如:
JAVA_OPTS="-server -Xms2048m -Xmx4096m -XX:PermSize=256M -XX:MaxPermSize=512m -Djava.security.egd=file:/dev/./urandom"
2)在JVM环境中解决
修改$JAVA_PATH/jre/lib/security/java.security
securerandom.source=file:/dev/urandom
替换成
securerandom.source=file:/dev/./urandom