Nemo

Nemo 关注TA

路漫漫其修远兮,吾将上下而求索。

Nemo

Nemo

关注TA

路漫漫其修远兮,吾将上下而求索。

  •  普罗旺斯
  • 负责帅就完事了
  • 写了1,496,113字

该文章投稿至Nemo社区   Java  板块 复制链接


tomcat8启动慢解决: At least one JAR was scanned for TLDs yet contained no TLDs.

发布于 2018/11/15 10:19 5,270浏览 0回复 1,283

b3b7d0a20cf431adfe004e4e4e36acaf2fdd98f2.jpg

部署某个旧项目时候,发现启动特别慢,要等好几分钟。然后每次部署都停留在

At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.

jdk环境是1.8,tomcat版本是8.0.


上下文日志:


securerandom.source=file:/dev/./urandom
15-Nov-2018 09:56:13.331 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
15-Nov-2018 09:59:29.043 WARNING [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [195,690] milliseconds.

可以看到,就是这个:

Creation of SecureRandom instance

导致了启动时间变长。




解决方案有两个:

1)在Tomcat环境中解决

可以通过配置JRE使用非阻塞的Entropy Source。

在catalina.sh中加入这么一行:

-Djava.security.egd=file:/dev/./urandom

即可。

2)在JVM环境中解决

打开$JAVA_PATH/jre/lib/security/java.security这个文件,找到下面的内容:

securerandom.source=file:/dev/urandom

替换成

securerandom.source=file:/dev/./urandom
本文标签
 {{tag}}
点了个评