Tomcat 在启动过程中加载众多 jar 文件,默认会对其做 TLDs 扫描,{CATALINA-HOME}/logs/catalina.out 文件中会出现大量下面的 log:
09-Dec-2017?20:03:14.289?FINE?[localhost-startStop-1]?org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan?No?TLD?files?were?found?in?[file:/home/apache-tomcat-8.5.4/lib/tomcat-redis-session-manager-master-2.0.0.jar].?Consider?adding?the?JAR?to?the?tomcat.util.scan.StandardJarScanFilter.jarsToSkip?property?in?CATALINA_BASE/conf/catalina.properties?file.
出现这样的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:
org.apache.catalina.webresources.Cache.getResource?Unable?to?add?the?resource?at?[**]?to?the?cache?because?there?was?insufficient?free?space?available?after?evicting?expired?cache?entries?-?consider?increasing?the?maximum?size?of?the?cache
只要在$CATALINA_BASE/conf/context.xml里增加资源最大可缓存的大小就行了,大小可按自己的需要定义:
<?xml?version=‘1.0‘?encoding=‘utf-8‘?> <Context> ????<WatchedResource>WEB-INF/web.xml</WatchedResource> ????<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource> ????<Resources ????????cachingAllowed="true" ????????cacheMaxSize="100000" ????/> </Context>
重启tomcat
原文地址:http://blog.51cto.com/shevastar/2049072