參考:http://stackoverflow.com/questions/14375673/how-to-fix-jsp-compiler-warning-one-jar-was-scanned-for-tlds-yet-contained-no-t
【問題描述】
Tomcat 在啟動過程中加載眾多 jar 文件,默認會對其做 TLDs 掃描,{CATALINA-HOME}/logs/catalina.xxxx-xx-xx.log (xxxx-xx-xx 形如 2015-11-03)文件中會出現(xiàn)大量下面的 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.
出現(xiàn)這樣的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)執(zhí)行下面命令(從這里拷貝)
會在 ~/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 下的所有內(nèi)容)重啟 Tomcat
重啟后,Tomcat 將不再對5)中的 jar 文件做 TLDs 掃描,web components 的加載速度也會顯著加快。
8)刪除1)中在 logging.properties 中添加的
- org.apache.jasper.servlet.TldScanner.level = FINE
~
本站僅提供存儲服務,所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權內(nèi)容,請
點擊舉報。