第一次遇到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"

最新文章

  1. Mysql - 查询之关联查询
  2. Java 集合系列04之 fail-fast总结(通过ArrayList来说明fail-fast的原理、解决办法)
  3. Windows下的Eclipse启动出现:a java runtime environment(JRE) or java development kit(JDK) must be
  4. QTP参数化
  5. linux crontab
  6. 编写一个简单的C++程序
  7. php数组高级小结(一)
  8. JAVA和android 环境配置
  9. autoresizingMask的用法
  10. python分页和session和计算时间差
  11. Ningx集群环境搭建
  12. 7-25 :active :after :before :disabled
  13. Mysql 账号过期问题
  14. 『MXNet』im2rec脚本使用以及数据读取
  15. Spring学习笔记3——消息队列(rabbitmq), 发送邮件
  16. Java学习之String
  17. tms web core pwa让你的WEB APP离线可用
  18. IIS 部署 Python Django网站流程(受够了野路子)
  19. Android错题集
  20. uwsgi+nginx项目上线

热门文章

  1. tomcat报错:java.io.IOException: No space left on device
  2. zookeeper06-watcher四字命令
  3. ECharts 提示框组件Tooltip属性大全(包含文本注释)
  4. 华为eNSP 基础企业级WLAN配置
  5. Vue3 组件之间的数据传递
  6. Nacos服务调用(基于Openfeign)
  7. 11款Linux数据恢复工具!
  8. Docker安装和卸载(centos)
  9. ASP.NET Core - 配置系统之配置读取
  10. left join(一)