阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Tomcat 提示“INFO deploying web application directory……” 解决方法

130次阅读
没有评论

共计 1862 个字符,预计需要花费 5 分钟才能阅读完成。

安装完毕 Tomcat,启动后总是卡住在“INFO deploying web application directory……”,浏览器访问 8080 端口,访问不到。修改成其他端口后,启动还是会卡很久,但是浏览器访问新配置的端口,就可以访问到。

如图:

Tomcat 提示“INFO deploying web application directory......”解决方法

解决方案:

此方案,借鉴网上的内容:

找到 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.linuxidc.com/Linux/2017-04/142476.htm

正文完
星哥说事-微信公众号
post-qrcode
 
星锅
版权声明:本站原创文章,由 星锅 2022-01-21发表,共计1862字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中