tomcat启动org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs问题导致启动慢?

问题的发现:
进行支付宝demo调试的时候,开始将项目部署到tomcat上面很正常,启动也很正常。突然一次启动,发现卡住了,然后以为启动失败了,开始找原因,报的问题就是: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.
网上查了半天到最后也没找到是什么原因导致的,也没有解决。然后再看服务器日志,发现,启动成功了,但是启动时间超级长。
这里写图片描述
是什么原因导致的呢?这个项目只是一个小demo啊,启动不至于这样吧。
于是想到了tomcat的启动日志:
15-May-2018 17:19:57.084 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/usr/local/apache-tomcat-8.5.31/webapps/alipay.trade.wap.pay-java-utf-8.war]
15-May-2018 17:19:58.143 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/].
15-May-2018 17:19:58.146 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/usr/local/apache-tomcat-8.5.31/webapps/alipay.trade.wap.pay-java-utf-8/WEB-INF/lib/alipay-sdk-java20170307171631.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
15-May-2018 17:19:58.160 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-May-2018 17:28:46.499 WARNING [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [528,295] milliseconds.
15-May-2018 17:28:46.527 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/usr/local/apache-tomcat-8.5.31/webapps/alipay.trade.wap.pay-java-utf-8.war] has finished in [529,443] ms
15-May-2018 17:28:46.542 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/apache-tomcat-8.5.31/webapps/manager]
15-May-2018 17:28:46.597 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/jsp/].
15-May-2018 17:28:46.597 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/].
15-May-2018 17:28:46.602 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/apache-tomcat-8.5.31/webapps/manager] has finished in [60] ms
15-May-2018 17:28:46.602 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/apache-tomcat-8.5.31/webapps/docs]
15-May-2018 17:28:46.630 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/].
15-May-2018 17:28:46.646 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/apache-tomcat-8.5.31/webapps/docs] has finished in [44] ms
15-May-2018 17:28:46.647 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/apache-tomcat-8.5.31/webapps/host-manager]
15-May-2018 17:28:46.677 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/jsp/].
15-May-2018 17:28:46.677 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/].
15-May-2018 17:28:46.679 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/apache-tomcat-8.5.31/webapps/host-manager] has finished in [32] ms
15-May-2018 17:28:46.680 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/apache-tomcat-8.5.31/webapps/examples]
15-May-2018 17:28:46.875 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/jsp/applet/].
15-May-2018 17:28:46.875 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths TLD files were found in resource path [/WEB-INF/jsp/].
15-May-2018 17:28:46.875 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/tags/].
15-May-2018 17:28:46.875 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths TLD files were found in resource path [/WEB-INF/jsp2/].
15-May-2018 17:28:46.875 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/].
15-May-2018 17:28:46.995 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan TLD files were found in JAR [file:/usr/local/apache-tomcat-8.5.31/webapps/examples/WEB-INF/lib/taglibs-standard-impl-1.2.5.jar].
15-May-2018 17:28:47.082 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/apache-tomcat-8.5.31/webapps/examples] has finished in [401] ms
15-May-2018 17:28:47.082 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/apache-tomcat-8.5.31/webapps/ROOT]
15-May-2018 17:28:47.108 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanResourcePaths No TLD files were found in resource path [/WEB-INF/].
15-May-2018 17:28:47.110 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/apache-tomcat-8.5.31/webapps/ROOT] has finished in [27] ms
15-May-2018 17:28:47.141 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [“http-nio-8080”]
15-May-2018 17:28:47.232 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [“ajp-nio-8009”]
15-May-2018 17:28:47.234 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 530255 ms

看到黑色加粗的那段,原来是这个原因导致的启动变慢,网上查了一下大佬们的博客熵池阻塞
里面讲到在JVM环境中解决

打开$JAVA_PATH/jre/lib/security/java.security这个文件,找到下面的内容:
securerandom.source=file:/dev/urandom
将其替换为:
securerandom.source=file:/dev/./urandom
但是那个文件的路径我找不到。后来找到一个方法:

[root@localhost ~]# java -version

java version "1.7.0_65"

OpenJDK Runtime Environment (rhel-2.5.1.2.el6_5-x86_64 u65-b17)

OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

[root@localhost ~]# which java

/usr/bin/java

[root@localhost ~]# ls -lrt /usr/bin/java

lrwxrwxrwx. 1 root root 22 Aug 17 15:12 /usr/bin/java -> /etc/alternatives/java

[root@localhost ~]# ls -lrt /etc/alternatives/java

lrwxrwxrwx. 1 root root 46 Aug 17 15:12 /etc/alternatives/java -> /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java

[root@localhost ~]# 

[root@localhost ~]# cd /usr/lib/jvm

[root@localhost jvm]# ls

java-1.6.0-openjdk-1.6.0.0.x86_64 java-1.7.0-openjdk-1.7.0.65.x86_64 jre jre-1.6.0 jre-1.6.0-openjdk.x86_64 jre-1.7.0 jre-1.7.0-openjdk.x86_64 jre-openjdk

于是找到了文件,修改后果然启动就快了!具体的原因,我想还得慢慢体会。

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值