重复启动Tomcat时,大概率出现Deploying web application direct

由前一篇文章开始折腾supervisor,想玩玩tomcat异常退出后使用supervisor自动让tomcat重新启动,
随即丢了一个tomcat在服务器里面,本来就没有放任何项目,空跑在那边,只是tomcat有个界面就看看起没起来。
 
于是手动停止tomcat的进程触发supervisor自动拉起服务,应该是没有问题的,但是,来来回回启动了个两三次,突然发现,tomcat竟然起不来了!

随即查阅下日志:

[email protected] bin]# tail -f ../logs/catalina.out
19-Jun-2018 15:57:06.666 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
19-Jun-2018 15:57:06.667 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
19-Jun-2018 15:57:06.667 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 535 ms
19-Jun-2018 15:57:06.684 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
19-Jun-2018 15:57:06.684 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.1.15
19-Jun-2018 15:57:06.690 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /opt/apache-tomcat-8.1.15-server/webapps/ROOT

卡在这个启动状态至少由10分钟才能完全启动起来,而且每次都这样。。。空跑都能这么操蛋?部署个项目还得了?难道要半小时?

网上查阅到有个大神写的文章,大意就是下面这句话:

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.

就是linux提供随机数设备是/dev/random 和/dev/urandom,一般我们都只是都使用"/dev/random",这个参数做随机数(因为每本操蛋的书都是这么写的!也没人说过为啥。)
 
两个有区别,urandom安全性没有random高,但random需要时间间隔生成随机数。jdk默认调用random。
 
所以根据上面的说法,修改配置文件:

find / -name securerandom.source

找到Java.security文件,在文件中找到securerandom.source这个设置项,将其改为:

securerandom.source=file:/dev/urandom

修改完毕后,重启tomcat,瞬间启动完毕。

原文地址:http://blog.51cto.com/luweiv998/2128332

时间: 2024-08-08 00:18:22

重复启动Tomcat时,大概率出现Deploying web application direct的相关文章

Tomcat启动时卡在“INFO: Deploying web application directory ”

今天在linux上的tomcat部署一个网站时,在刚启动tomcat的时候提示启动成功,然后也能访问成功. 可是第二次启动时虽然没有报错,但无法访问tomcat,查看了catalina.out日志,发现tomcat卡在了INFO: Deploying web application directory ...... 后来看了一篇博文解决了问题.在 $JAVA_HOME/jre/lib/security/java.security内,将securerandom.source的内容改为file:/d

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

转载地址:http://blog.csdn.net/njchenyi/article/details/46641141 第一次遇到Tomcat在Linux服务器启动卡住的情况,情况很简单,tomcat启动以后卡在INFO: Deploying web application directory ......这句话,具体会卡多久就没测试了.google.baidu都没找到解决方法. 幸亏UCloud的技术支持人员给出了解决方案. 找到jdk1.x.x_xx/jre/lib/security/Jav

启动tomcat时,一直卡在Deploying web application directory这块的解决方案

本来今天正常往服务器上扔一个tomcat 部署一个项目的, 最后再启动tomcat 的时候 发现项目一直都访问不了,看了一下日志: [email protected] bin]# tail -f ../logs/catalina.out 09-Jun-2017 15:57:06.666 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"] 09-

[转]Eclipse启动Tomcat时45秒超时解决方法

原文地址:http://it.oyksoft.com/post/6577/ Eclipse启动Tomcat时,默认配置的启动超时时长为45秒.假若项目启动超过45秒将会报错.两种解决方法:1.改XMLeclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\servers.xml start-timeout="45" 2.双击Servers视图中的对应的Server,打开Server的属性界面,右边有个Timeou

Eclipse启动Tomcat时,45秒超时解决方式

在Eclipse中启动Tomcat服务器时,经常由于系统初始化项目多,导致出现45秒超时的Tomcat服务器启动错误,出现下面的错误. 以前我们一般通过找到XML配置文件,将对应Timeout为45的值,修改为认为足够大来解决问题. 但是有时候这样很麻烦,有时候根本就在配置文件中找不到Timeout的属性值,所以这里有一种可以快速的解决方法. 解决方法: 1.双击Servers视图中的对应的Server,打开Server的属性界面.如下图: 2.在上图的Timeouts->Start属性中,将值

Eclipse启动Tomcat时45秒超时的解决方法

Eclipse启动Tomcat时,默认配置的启动超时时长为45秒.假若项目需要加载的东西比较多,启动时间会比较久,如果启动超过45秒将会报错.有两种解决途径,方法只有一个,就是修改启动时间. 1. 修改eclipse的工作空间下面的server.xml配置文件. 找到eclipse的工作空间,在工作空间里面找到server.xml配置文件,例如我的eclipse的server.xml是在:E:\program\workspace\.metadata\.plugins\org.eclipse.ws

Eclipse启动Tomcat时45秒超时解决方法

Eclipse启动Tomcat时,默认配置的启动超时时长为45秒.假若项目启动超过45秒将会报错. 两种解决方法:1.改XMLeclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\servers.xml start-timeout="45" 修改 workspace\.metadata\.plugins\org.eclipse.wst.server.core\servers.xml文件. <servers

使用Tomcat时出现问题:严重: Error deploying web application directory G:\MyEclipseWorkspaces\.metadata\.me_tcat7\webapps\hiber_test

今天我写了第一个jsp和Servlet,然后再myeclipse上使用tomcat来搭建服务器,登录时出现的问题. 出现问题: 严重: Error deploying web application directory G:\MyEclipseWorkspaces\.metadata\.me_tcat7\webapps\hiber_test 按照老师教的步骤一步一步来,结果打开jsp网页时还是报错了 一开始我还以为是Tomcat版本问题,然后换了6和7,又用了myeclipse自带的那两个,结果

启动tomcat时遇到的问题

1.当启动Tomcat时,出现了如下信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\tools\myeclipse\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\bin;D:\Progr