原文地址:
http://blog.csdn.net/yasi_xi/article/details/49642661
参考:
【问题描述】
Tomcat 在启动过程中加载众多 jar 文件,默认会对其做 TLDs 扫描,{CATALINA-HOME}/logs/catalina.xxxx-xx-xx.log (xxxx-xx-xx 形如 2015-11-03)文件中会出现大量下面的 log:
-
04-Nov-2015 07:50:06.372 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.
出现这样的log说明,这条log所指的 jar 做了TLDs的扫描,并且没有在其中找到 TLDs,并且建议打开debug级别的log,查看相关的 jar 文件,在 Tomcat 配置文件中忽略对这样的 jar 的TLDs扫描。
【操作】
1)编辑 {CATALINA-HOME}/conf/logging.properties 文件,在文件末尾添加:
-
org.apache.jasper.servlet.TldScanner.level = FINE
2)重启Tomcat
3)等待Tomcat重启完成,并且相关web components都加载完成,能够正常工作。此时,在 {CATALINA-HOME}/logs/catalina.xxxx-xx-xx.log 文件中能看到类似下面的log:
-
04-Nov-2015 07:54:36.941 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 1032825 ms
4)cd {CATALINA-HOME}/logs/
5)执行下面命令(从拷贝)
egrep "No TLD files were found in \[file:[^\]+\]" catalina.out -o | egrep "[^]/]+.jar" -o | sort | uniq | sed -e 's/.jar/.jar,\\/g' > skips.txt
会在 ~/skips.txt 中得到类似下面的结果:
-
axis-1.4.0.jar,\
-
axis-ant-1.3.jar,\
-
axis-ant-1.4.jar,\
-
axis-jaxrpc-1.1.jar,\
-
axis-saaj-1.2.jar,\
-
axis-wsdl4j-1.5.1.jar,\
-
backport-util-concurrent-3.1.jar,\
-
batik-css-1.7.jar,\
-
batik-ext-1.7.jar,\
-
batik-util-1.7.jar,\
-
bcmail-jdk15-138.jar,\
-
bcmail-jdk15-149.jar,\
-
bcpg-jdk15-138.jar,\
-
bcpg-jdk15on-149.jar,\
6)将上面的结果放到 {CATALINA-HOME}/conf/catalina.properties 文件中的 “tomcat.util.scan.StandardJarScanFilter.jarsToSkip=” 处,保存该文件
7)(最好先删除 {CATALINA-HOME}/work 下的所有内容)重启 Tomcat
重启后,Tomcat 将不再对5)中的 jar 文件做 TLDs 扫描,web components 的加载速度也会显著加快。
8)删除1)中在 logging.properties 中添加的
-
org.apache.jasper.servlet.TldScanner.level = FINE
~
阅读(31629) | 评论(0) | 转发(0) |