`

Tomcat启动时卡在“INFO: Deploying web application directory ......”的解决方法

阅读更多

第一次遇到Tomcat在Linux服务器启动卡住的情况,情况很简单,tomcat启动以后卡在INFO: Deploying web application directory ......这句话,具体会卡多久就没测试了。google、baidu都没找到解决方法。

 

幸亏UCloud的技术支持人员给出了解决方案。

 

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

 

securerandom.source=file:/dev/./urandom

 

这时候根据修改内容就可以查到因为此原因不仅可以造成tomcat卡住,也会造成weblogic启动缓慢,

 

 

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


再后来,终于在weblogic的官方文档中 Monitoring and Troubleshooting 找到了 Avoiding JVM Delays Caused By Random Number Generation 这样一个标题。摘录如下:

The library used for random number generation in Sun's JVM relies on /dev/random by default for UNIX platforms. This can potentially block the Oracle WebLogic Communication Services process because on some operating systems /dev/random waits for a certain amount of "noise" to be generated on the host machine before returning a result. Although /dev/random is more secure, Oracle recommends using /dev/urandom if the default JVM configuration delays Oracle WebLogic Communication Services startup.

To determine if your operating system exhibits this behavior, try displaying a portion of the file from a shell prompt:

head -n 1 /dev/random
Open the $JAVA_HOME/jre/lib/security/java.security file in a text editor.

Change the line:

securerandom.source=file:/dev/random
to read:

securerandom.source=file:/dev/urandom
Save your change and exit the text editor.
其中说到:可通过 head -n 1 /devrandom 查看是否你的系统会出现伪随机数提供等待。OK就这个,试了一下,果然,在服务器第一次启动后,这个可以快速提供一个值,但当再次调用时发生等待。


解决办法:


永久:oracle 说修改 $JAVA_HOME/jre/lib/security/java.security 文件,替换securerandom.source=file:/dev/random 为 securerandom.source=file:/dev/urandom。对所有使用JVM的应用生效。(这个永久的方法,这里面有个问题,就是设置时候实际应该设置为securerandom.source=file:/dev/./urandom,否则不生效)


DOMAIN临时:修改startWeblogic.sh文件,JAVA_OPTIONS="${SAVE_JAVA_OPTIONS} -Djava.security.egd=file:/dev/./urandom"


后继的SecureRandom 测试学习


编写JAVA类如下,运行测试,第一次正常,第二次等待,重启服务器后第一次又正常。启动加入参数 -Djava.security.egd=file:/dev/./urandom 正常

 

原文:http://www.ithao123.cn/content-8455259.html

 

 

最近发现在阿里云服务器上启动tomcat的时候会存在卡住的情况,这种情况是每次必现,通过搜索发现是随机数生成问题.解决方案如下:

在服务器启动时也可以加上参数 -Djava.security.egd=file:/dev/./urandom

在文件catalina.sh:

JAVA_OPTS="-Xms2g -Xmx2g -XX:MaxMetaspaceSize=256m -Djava.security.egd=file:/dev/./urandom"


    注: Linux或者部分unix系统提供随机数设备是/dev/random 和/dev/urandom ,两个有区别,urandom安全性没有random高,但random需要时间间隔生成随机数。可能在生成随机数的时候卡住了,导致tomcat启动不了
--------------------- 
作者:TommyWu01 
来源:CSDN 
原文:https://blog.csdn.net/huahuagongzi99999/article/details/80227984 
版权声明:本文为博主原创文章,转载请附上博文链接!

分享到:
评论

相关推荐

    信息: Deploying web application directory lx01

    由于这个错误,Tomcat跳过了安装应用监听器的步骤,并在启动`/blog`上下文时遇到了错误。这最终导致了应用启动的失败。 解决这个问题的步骤可能包括: 1. **检查类路径**:确保`spring-web.jar`或包含`...

    tomcat-juli.jar,tomcat-juli-adapters.jar,log4j-1.2.17.jar tomcat 8日志输出

    {"time":"2017-09-06 10:24:48,356","logtype":"INFO","loginfo":"org.apache.catalina.startup.HostConfig:Deploying web application directory C:\Users\admin\Desktop\Tomcat8\webapps\docs"} {"time":"2017-09-...

    Tomcat 启动慢

    当在生产环境中部署Tomcat应用时,如果遇到长时间卡在“INFO: Deploying web application directory”的情况,这通常意味着Tomcat在部署Web应用的过程中遇到了某些瓶颈或问题,导致启动过程变得异常缓慢。...

    Microsoft Windows Net Server 2003 Deployment Resource Kit Designing And Deploying Directory And Security Services

    This resource provides detailed guidance on how to design and deploy directory services, including upgrading and restructuring domains, as well as designing and deploying directory services, and more.

    apache-tomcat-9.0.82.tar.gz

    注意:如果在使用Tomcat时出现了Error deploying web application directory web222,很大原因就是jdk和tomcat的版本不匹配。目前,jdk8不能匹配tomcat7.0,所以要降低jdk版本【换成JDK7】 目录的简单介绍 bin:启动...

    Apache Geronimo 2.1_ Quick Reference.pdf

    Deploying and running or debugging the application in Geronimo 305 Summary 306 Chapter 12: Clustering 307 WADI 308 Updating deployment descriptor and deployment plan 308 Load balancing with ...

Global site tag (gtag.js) - Google Analytics