项目场景:
环境:
tomcat 9.35
jkd8
我们有个老项目部署用的tomcat,每次上线发布都需要 8 分钟,测试环境却不要
问题描述
在这一块需要好久始终卡死在 org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory
01-Jun-2019 18:02:38.788 信息 [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.29
01-Jun-2019 18:02:38.821 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/root/tomcat/webapps/ROOT]
原因分析:
上网搜索结果大都是说随机数问题需要修改随机数方法
1.jdk
编辑$JAVA_HOME/jre/lib/security/Java.security文件,将securerandom.source=file:/dev/random 换成 securerandom.source=file:/dev/urandom 即可
2.tomcat中修改 在tomcat配置文件catalina.sh中修改
tomcat的catalina.sh文件位于tomcat目录下的bin目录下,通过在catalina.sh文件添加 -Djava.security.egd=file:/dev/urandom
经过上面尝试重启后还是如往常一样,当时请教了领导他说以前遇到过一个类似的问题去翻过源码,然后说让我修改 /etc/hosts 中把当前主机名加上,然后可以了,重启只要 20s 了,我当时惊呆了,这没有相关经验谁知道这种问题如何解决
解决方案:
vi /etc/hosts
#加上这句话
127.0.0.1 xxxx(对应主机名)
相关文章:
mac上启动springboot项目很慢的解决方案netAddress.getLocalHost().getHostName() took 5002 milliseconds to respond
springboot 日志中也提示了需要在 /etc/hosts 添加
restartedMain] o.s.boot.StartupInfoLogger: InetAddress.getLocalHost().getHostName()
took 5009 milliseconds to respond.
Please verify your network configuration
(macOS machines may need to add entries to /etc/hosts).
(macOS machines may need to add entries to /etc/hosts).