tomcat 启动一直卡在

Root WebApplicationContext: initialization completed in

重启了很多次,更换jdk版本,tomcat版本都不行。

tomcat所在的JVM进程已经被启动了所以可以排除是JVM退出引起的问题。那么问题真的就是JVM因为某种原因被阻塞了。

https://blog.csdn.net/wwdwjm/article/details/77840113

主要是因为阿里云的熵池太小 熵池的大小是根据键盘 鼠标之类的噪音产生的数 然后/dev/random会根据熵池来生成随机数 而生成需要有足够的熵池里的噪音数 如果没有达到的话就会一直阻塞 tomcat启动的时候为了生成session id就会获取这个随机数来生成密匙 所以才出现上面的情况 一直阻塞在等待熵池里的数满足生成随机数的大小 3分钟以后熵池里的数够大了才开始部署

yum install -y rng-tools
systemctl start rngd
cp /usr/lib/systemd/system/rngd.service /etc/systemd/system
vi /etc/systemd/system/rngd.service

ExecStart=/sbin/rngd -f -r /dev/urandom

WARNING: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [348,853] milliseconds

后来查了一下,发现这个问题抱怨的还是蛮多的,以至于tomcat的wiki里面还单独列出来作为加速启动的一个方面:

Tomcat 7+ heavily relies on SecureRandom class to provide random values for its session ids and in other places. Depending on your JRE it can cause delays during startup if entropy source that is used to initialize SecureRandom is short of entropy. You will see warning in the logs when this happens, e.g.:

There is a way to configure JRE to use a non-blocking entropy source by setting the following system property: -Djava.security.egd=file:/dev/./urandom

尝试使用-Djava.security.egd=file:/dev/./urandom启动了一下,果然快了很多。

https://wiki.apache.org/tomcat/HowTo/FasterStartUp

Centos6

yum install rng-tools -y
cat /etc/sysconfig/rngd # Add extra options here
EXTRAOPTIONS="-r /dev/urandom" service rngd start
cat /proc/sys/kernel/random/entropy_avail

Tomcat 启动卡在 Root WebApplicationContext: initialization completed in的更多相关文章

  1. tomcat启动时非常慢,启动时 一直卡在Root WebApplicationContext: initialization completed(转)

    转载地址:https://www.cnblogs.com/youxin/p/8793554.html 使用方式: JAVA_OPTS="-Djava.awt.headless=true -D ...

  2. tomcat启动时非常慢,启动时 一直卡在Root WebApplicationContext: initialization completed

    每次重启自己的服务tomcat都需要卡住很长时间,每次都是日志停在 Root WebApplicationContext: initialization completed in 744 ms这个地方 ...

  3. Eclipse 中 Tomcat启动卡100%(preparing launch delegate...)

    我自己遇到这个问题的时候去百度了好几天,没找到我的解决方案,因为我的错误和别人不一样,但提示却和别人一样,在tomcat启动到100%的时候,卡住了,最后显示45秒不够启动,建议我增加时间,所以结果可 ...

  4. tomcat启动卡在了 At least one JAR was scanned for TLDs yet contained no TLDs 的根本原因与解决办法

    1.前言 有时候服务器开启时启动不了,卡在了 org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned fo ...

  5. SpringMVC Root WebApplicationContext启动流程

    传统的SpringMVC项目中,需要在web.xml中配置Contextlistener.ContextLoaderListener是负责引导启动和关闭Spring的Root上下文的监听器.主要将处理 ...

  6. Linux中tomcat启动很慢,SessionIdGeneratorBase.createSecureRandom耗时5分钟

    通常情况下,tomcat启动只要2~3秒钟,突然有一天,tomcat启动非常慢,要花5~6分钟,查了很久,终于在这篇文章找到了解决方案,博主牛人啊. 原文参见:http://blog.csdn.NET ...

  7. tomcat 启动超级慢

    今天在新环境里部署tomcat, 刚开始启动很快,关闭之后再启动,却发现启动日志打印到 00:25:14.144 [localhost-startStop-1] INFO  o.s.web.conte ...

  8. tomcat启动报错:java.lang.NoClassDefFoundError

    tomcat启动加载spring配置文件时报错,找不到类GetBooksRequest,经排查实际上该类已经存在.后来发现日志里还有一句: This is very likely to create ...

  9. javaweb 工程 tomcat启动报错的问你

    2015-03-03 14:39:32,657 INFO (org.springframework.web.context.ContextLoader:296) - Root WebApplicati ...

随机推荐

  1. ajax将数组或list集合传到后台 的 【坑】

    代码如下 function deleteChecked() { var orderNosList = new Array(); var rows = $("#dataGrid"). ...

  2. Kubernetes-kubectl The connection to the server localhost:8080 was refused -did you specify

    今天在Kubernetes的从节点上运行命令[kubectl]出现了如下错误: [root@k8snode1 kubernetes]# kubectl get pod The connection t ...

  3. 【AMAD】django-countries -- 为Django app的form提供country选项,为model提供CountryField

    动机 简介 个人评分 动机 有时候看一些数据库设计,国家数据会存在一个单独的表里面.这种方式读取数据库无疑又要加上一层join,很不划算. 简介 [django-countries]1解决的是: 不用 ...

  4. 安装vsftpd

    通用安装和配置 1.下载安装包并安装 wget http://mirror.centos.org/centos/7/os/x86_64/Packages/vsftpd-3.0.2-25.el7.x86 ...

  5. Leetcode之动态规划(DP)专题-486. 预测赢家(Predict the Winner)

    Leetcode之动态规划(DP)专题-486. 预测赢家(Predict the Winner) 给定一个表示分数的非负整数数组. 玩家1从数组任意一端拿取一个分数,随后玩家2继续从剩余数组任意一端 ...

  6. 【机器学习】Matlab中实现QQ-plot的一个好工具gqqplot

    Matlab中实现QQ-plot的一个好工具gqqplot 26JUN June 26, 2013 这几天看了一下QQ-plot以及在Matlab中的实现,可是Matlab自带的qqplot函数不能满 ...

  7. PHP学习(7)——面向对象(上)

    1.理解面向对象的概念 面向对象软件的一个重要优点是支持和鼓励封装的能力.封装也叫数据隐藏. 在面向对象的软件中,对象是一个被保存数据和操作这些数据的操作方法的唯一.可标识的集合. 对象可以按类进行分 ...

  8. JAVA上传文件到数据库

    前端代码 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> &l ...

  9. 15.sqoop数据从mysql里面导入到HDFS里面

    表数据 在mysql中有一个库userdb中三个表:emp, emp_add和emp_contact 表emp id name deg salary dept 1201 gopal manager 5 ...

  10. 基于 CentOS 7 搭建 GitLab

    ⒈更新软件包 yum update -y ⒉安装 ssh服务并启动 yum install -y curl policycoreutils-python openssh-server systemct ...