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

[localhost-startStop-1]的更多相关文章

  1. zookeeper报错java.net.ConnectException: Connection refused: no further information

    zookeeper报错java.net.ConnectException: Connection refused: no further information 这是在linux 启动 https:/ ...

  2. 2003-Can't connect to mysql server on localhost (10061)

    mysql数据库出现2003-Can't connect to mysql server on localhost (10061)问题 解决办法:查看wampserver服务器是否启动,如果没有启动启 ...

  3. MySql Access denied for user 'root'@'localhost' (using password:YES) 解决方案

    关于昨天下午说的MySQL服务无法启动的问题,解决之后没有进入数据库,就直接关闭了电脑. 今早打开电脑,开始-运行 输入"mysql -uroot -pmyadmin"后出现以下错 ...

  4. Server Tomcat v7.0 Server at localhost was unable to start within 45 seconds

    错误:Server Tomcat v7.0 Server at localhost was unable to start within 45 seconds 错误提示就是我们限定了部署的时间导致的错 ...

  5. ssh无密码登录The authenticity of host 'localhost (::1)' can't be established.

    The authenticity of host 'localhost (::1)' can't be established. http://blog.csdn.net/cyuyan112233/a ...

  6. phpmyadmin #1045 - Access denied for user 'root'@'localhost' (using password: NO)

    phpmyadmin访问遇到1045问题 #1045 - Access denied for user 'root'@'localhost' (using password: NO) 解决办法 找到p ...

  7. eclipse启动tomcat, http://localhost:8080无法访问

    原地址 症状: tomcat在eclipse里面能正常启动,而在浏览器中访问http://localhost:8080/不能访问,且报404错误.同时其他项目页面也不能访问. 关闭eclipse里面的 ...

  8. 解决ssh localhost中root@localhost:要求输入密码问题(已经进行了无密码设置登录)

    首先删除~/.ssh目录下的3个文件,如下 id_rsa authorized_keys id_rsa.pub 然后 exit # 退出刚才的 ssh localhostcd ~/.ssh/ # 若没 ...

  9. MySql数据库:Host 'localhost' is not allowed to connect to this MySQL server

    修改mysql的root密码后,出现Host 'localhost' is not allowed to connect to this MySQL server 错误. 解决办法: C:\Progr ...

  10. 诡异的localhost无法连接

    上午试了localhost发现提示无法连接,ping了下localhost,能够ping通. 重启了Apache,还是无法解决. 试着停止了Apache服务,然后再连接localhost,发现浏览器提 ...

随机推荐

  1. 真正“搞”懂HTTP协议11之代理服务

    代理,其实全称应该叫做代理服务器,它是客户端与服务器之间得中间层,本质上来说代理就是一个服务器,在HTTP的链路中插入的一个中间环节,就是代理服务器啦.所谓的代理服务就是指:服务本身不生产内容,而是处 ...

  2. 力扣---45. 跳跃游戏 II

    给定一个长度为 n 的 0 索引整数数组 nums.初始位置为 nums[0].每个元素 nums[i] 表示从索引 i 向前跳转的最大长度.换句话说,如果你在 nums[i] 处,你可以跳转到任意 ...

  3. Windows/office常用的激活工具有哪些

    Windows/office常用的激活方式 Windows激活方式有两种 Kms激活与数字权利永久激活,这两种激活方式各有优势,KMS激活通用性强(支持Windows+Office),但只能激活180 ...

  4. Class path contains multiple SLF4J bindings解决

    1.根据控制台查看冲突的日志依赖 本工程Maven依赖 <dependencies> <dependency> <groupId>org.slf4j</gro ...

  5. Vue搭建项目的完整流程 如何搭建一个完整的vue项目 vue项目架构

    vue项目架构 技术栈:vue3.vue-router .vuex(和pinia).element plus .axios.ts.sass 1.安装vue3 脚手架+ ts vue create ad ...

  6. 【SDOI2015】排序

    #include<cstdio> #include<iostream> using namespace std; typedef long long LL; const int ...

  7. Luogu P1505.[国家集训队]旅游

    题解 真真正正是个码农题,不过很套路,熟练就打得很快,不过要用点维护边的信息在 \(\text{LCA}\) 出要注意,不能处理此点的信息 \(Code\) #include<cstdio> ...

  8. VueJs 监听 window.resize 方法---窗口变化

    mounted() { let _this = this; window.onresize = ()=>{ return (()=>{ this.vscreen.height=docume ...

  9. npm+react linux 开荒

    安装npm 从 https://nodejs.org/dist/ 找到下载包,并不是版本越高越好,得看项目的需要. 解压之后,将解压路径bin添加到PATH里. 完成后可配置npm源 npm inst ...

  10. sqlserver 行转列 列转行

    行列互转,是一个经常遇到的需求.实现的方法,有case when方式和2005之后的内置pivot和unpivot方法来实现. 在读了技术内幕那一节后,虽说这些解决方案早就用过了,却没有系统性的认识和 ...