【问题描述】
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扫描。
【操作】
以下 tomcat 均指的是的 tomcat的目录
1)编辑 tomcat/conf/logging.properties 文件,在文件末尾添加:
- org.apache.jasper.servlet.TldScanner.level = FINE
2)重启Tomcat
3)等待Tomcat重启完成,并且相关web components都加载完成,能够正常工作。此时,在 tomcat/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 tomcat/logs/
5)执行下面命令
- egrep "No TLD files were found in \[file:[^\]+\]" /www/server/tomcat/logs/catalina.out -o | egrep "[^]/]+.jar" -o | sort | uniq | sed -e 's/.jar/.jar,\\/g' > skips.txt
会在 ~/skips.txt 中得到类似下面的结果:
- activation-1.1.1.jar,\
- aopalliance-1.0.jar,\
- apiguardian-api-1.0.0.jar,\
- bcprov-jdk15-1.45.jar,\
- c3p0-0.9.2.1.jar,\
- cxf-api-2.3.1.jar,\
- cxf-common-schemas-2.3.1.jar,\
- cxf-common-utilities-2.3.1.jar,\
- cxf-rt-bindings-soap-2.3.1.jar,\
- cxf-rt-bindings-xml-2.3.1.jar,\
- cxf-rt-core-2.3.1.jar,\
- cxf-rt-databinding-jaxb-2.3.1.jar,\
- cxf-rt-frontend-jaxws-2.3.1.jar,\
- cxf-rt-frontend-simple-2.3.1.jar,\
- cxf-rt-transports-http-2.3.1.jar,\
- cxf-rt-ws-addr-2.3.1.jar,\
- cxf-rt-ws-security-2.3.1.jar,\
- cxf-tools-common-2.3.1.jar,\
- druid-1.0.16.jar,\
- geronimo-javamail_1.4_spec-1.7.1.jar,\
- jackson-annotations-2.9.0.jar,\
- jackson-core-2.9.0.jar,\
- jackson-databind-2.9.0.jar,\
- javax.servlet.jsp-api-2.3.1.jar,\
- jaxb-impl-2.1.13.jar,\
- json-20170516.jar,\
- jstl-1.1.2.jar,\
- mchange-commons-java-0.2.3.4.jar,\
- mybatis-3.4.0.jar,\
- mybatis-spring-1.3.0.jar,\
- mysql-connector-java-5.1.30.jar,\
- neethi-2.0.4.jar,\
- opentest4j-1.0.0.jar,\
- serializer-2.7.1.jar,\
- spring-aop-4.2.0.RELEASE.jar,\
- spring-aspects-4.2.0.RELEASE.jar,\
- spring-beans-4.2.0.RELEASE.jar,\
- spring-context-4.2.0.RELEASE.jar,\
- spring-context-support-4.2.0.RELEASE.jar,\
- spring-core-4.2.0.RELEASE.jar,\
- spring-expression-4.2.0.RELEASE.jar,\
- spring-jdbc-4.2.0.RELEASE.jar,\
- spring-test-4.2.0.RELEASE.jar,\
- spring-tx-4.2.0.RELEASE.jar,\
- spring-web-4.2.0.RELEASE.jar,\
- stax2-api-3.0.2.jar,\
- woodstox-core-asl-4.0.8.jar,\
- wss4j-1.5.10.jar,\
- xalan-2.7.1.jar,\
- xml-resolver-1.2.jar,\
- XmlSchema-1.4.7.jar,\
- xmlsec-1.4.4.jar,\
6)将上面的结果放到 tomcat/conf/catalina.properties 文件中的 “tomcat.util.scan.StandardJarScanFilter.jarsToSkip=” 处,保存该文件
7)(最好先删除 tomcat/work 下的所有内容)重启 Tomcat
重启后,Tomcat 将不再对5)中的 jar 文件做 TLDs 扫描,web components 的加载速度也会显著加快。
8)删除1)中在 logging.properties 中添加的
- org.apache.jasper.servlet.TldScanner.level = FINE
原文地址:http://blog.csdn.net/yasi_xi/article/details/49642661
相关问题:https://stackoverflow.com/questions/14375673/how-to-fix-jsp-compiler-warning-one-jar-was-scanned-for-tlds-yet-contained-no-t
您可以选择一种方式赞助本站
支付宝扫一扫赞助
微信钱包扫描赞助
赏