欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

Linux服务器tomact 8.0启动慢的完美解决方法

程序员文章站 2023-11-10 16:19:16
环境信息: centos release 6.8 tomcat-8.0 jdk1.8 一、启动tomcat #sh /root/tomcat-8.0/bi...

环境信息:

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
26-aug-2017 12:58:31.661 info [main] org.apache.tomcat.util.net.nioselectorpool.getsharedselector using a shared selector for servlet write/read
26-aug-2017 12:58:31.662 info [main] org.apache.catalina.startup.catalina.load initialization processed in 680 ms
26-aug-2017 12:58:31.685 info [main] org.apache.catalina.core.standardservice.startinternal starting service catalina
26-aug-2017 12:58:31.685 info [main] org.apache.catalina.core.standardengine.startinternal starting servlet engine: apache tomcat/8.0.32
26-aug-2017 12:58:31.695 info [localhost-startstop-1] org.apache.catalina.startup.hostconfig.deploydirectory deploying web application directory /root/tomcat-8.0/webapps/root
26-aug-2017 12:58:36.184 info [localhost-startstop-1] 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.
26-aug-2017 12:58:37.895 info [localhost-startstop-1] java.util.prefs.filesystempreferences$2.run created system preferences directory in java.home.
26-aug-2017 12:58:37.897 info [localhost-startstop-1] java.util.prefs.filesystempreferences$1.run created user preferences directory.
26-aug-2017 12:58:37.907 warning [localhost-startstop-1] java.util.prefs.filesystempreferences$6.run prefs file removed in background /root/.java/.userprefs/prefs.xml
26-aug-2017 12:58:37.908 warning [localhost-startstop-1] java.util.prefs.filesystempreferences$6.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

总结

以上所述是小编给大家介绍的linux服务器tomact 8.0启动慢的完美解决方法,希望对大家有所帮助