`

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卡死在 Deploying web application 步骤的问题.doc

    在生产环境中部署web应用程序时,Tomcat卡死在Deploying web application步骤的问题是一个常见的问题。这个问题可能是由于多种原因引起的,包括但不限于securerandom.source[file:/dev/./urandom]没有指定、数据库...

    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应用的过程中遇到了某些瓶颈或问题,导致启动过程变得异常缓慢。...

    Cisco Press:Deploying Voice over Wireless LANs.chm

    Cisco - Deploying Voice over Wireless LANs.chm Copyright About the Author Acknowledgments Icons Used in This Book Command Syntax Conventions Introduction Part I: Fundamental Elements Chapter ...

    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:启动...

    ASP.NET 3.5 Website Programming: Problem - Design - Solution

    Chapter 13: Deploying the Site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....

    tomcat 环境配置及问题处理

    1. **问题描述**:在安装和配置好环境变量之后,尝试运行`tomcat6w.exe`时,出现“指定的服务并未以已安装的服务存在”的提示;另外,运行`tomcat6.exe`时程序窗口会立即关闭。 2. **解决方法**: - 使用管理员...

    spring MVC 最新教程

     Chapter 3: Web Application Architecture..............................................................51  Chapter 4: Spring MVC Architecture...........................................................

    Servlets和JSP核心技术 卷2(英文版) 第一部分

    Using and Deploying Web Applications Section 1.1. Purpose of Web Applications Section 1.2. Structure of Web Applications Section 1.3. Registering Web Applications with the Server Section 1.4. ...

    Servlets和JSP核心技术 卷2(英文版) 第二部分

    Using and Deploying Web Applications Section 1.1. Purpose of Web Applications Section 1.2. Structure of Web Applications Section 1.3. Registering Web Applications with the Server Section 1.4. ...

    Using Docker: Developing and Deploying Software with Containers.pdf

    Get started with Docker by building and deploying a simple web applicationUse Continuous Deployment techniques to push your application to production multiple times a dayLearn various options and ...

    Programming with MS VB.NET.pdf

    Contents Introduction Course Materials......................................................................................................2 Prerequisites...........................................

    VB.Net Programming.pdf

    Contents Introduction Course Materials..................................................................................................2 Prerequisites.................................................

    Beginning.Amazon.Web.Services.with.Node.js.1484206541

    Beginning Amazon Web Services with Node.js teaches any novice Node.js developer to configure, deploy, and maintain scalable small to large scale Node.js applications in Amazon Web Services. Hosting a ...

    MSDN Traning - VB.NET (VBL).pdf

    Programming with Microsoft® Visual Basic® .NET (Prerelease) iii Contents Introduction Course Materials.......................................................................................

    Programming with Microsoft Visual Basic.NET_Delivery Guide.pdf

    Contents Introduction Course Materials.........................................................................................2 Prerequisites........................................................

    Developing Flex Applications 910p dda_doc88_cracker.zip

    2. a web page viewer for doc88 ebt 3. a DDA downloader for doc88.com CONTENTS PART I: Presenting Flex CHAPTER 1: Introducing Flex. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

Global site tag (gtag.js) - Google Analytics