简体   繁体   English

Tomcat服务器启动缓慢

[英]Tomcat server starts slowly

I have a situation where Tomcat is starting with my java application, but then hangs for several minutes before continuing.我的情况是 Tomcat 从我的 Java 应用程序开始,但在继续之前挂起几分钟。 Startup logs do not seem to point to anything specific.启动日志似乎没有指向任何特定的内容。

Is there a way that I could debug this?有没有办法调试这个?

I encountered once a problem where starting Tomcat on a dedicated server also took ages.我曾经遇到过在专用服务器上启动 Tomcat 也需要很长时间的问题。 My problem was that the entropy source that is used to initialize SecureRandom was short of entropy.我的问题是用于初始化 SecureRandom 的熵源缺少熵。

It's a known bug: https://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source这是一个已知的错误: https : //wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source

If this is your problem, known workarounds are:如果这是您的问题,已知的解决方法是:

Set the following system property: -Djava.security.egd=file:/dev/./urandom设置以下系统属性:-Djava.security.egd=file:/dev/./urandom

or或者

Use 'new SecureRandom()' instead of 'SecureRandom.getInstance("SHA1PRNG")' (if you have this in your code [source] ).使用 'new SecureRandom()' 而不是 'SecureRandom.getInstance("SHA1PRNG")'(如果你的代码中有这个[source] )。

Your question is very broad.你的问题很广泛。 We have nothing to work with here in providing an answer.在提供答案方面,我们没有什么可合作的。

All I can give you is generic debugging advice.我所能提供的只是通用的调试建议。

  • Add printouts into your web application's startup sequence.将打印输出添加到 Web 应用程序的启动序列中。 Watch them and see where it hangs.观察它们,看看它挂在哪里。

  • Try commenting out part for part of the start-up until you notice that start-up is suddenly sped up, the last bit you commented out should be the faulty one.尝试将部分启动部分注释掉,直到您注意到启动突然加速,您注释掉的最后一点应该是错误的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM