各種tomcat啓動錯誤

Tomcat8

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章