Tomcat啓動慢 At least one JAR was scanned for

At least one JAR was scanned for TLDs yet contained no TLDs

環境css

  • CentOS 7.4web

  • jdk-10.0.2apache

  • apache-tomcat-9.0.11tomcat

    29-Aug-2018 19:21:32.257 INFO [main] 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.

出現問題的緣由是 Tomcat 在啓動過程當中加載衆多 jar 文件,默認會對其作 TLDs 掃描。 有博客說,修改tomcat屬性,忽略對EL表達式的關鍵字檢查。修改 $CATALINA_BASE/conf/catalina.properties文件,添加org.apache.el.parser.SKIP_IDENTIFIER_CHECK=true選項。但並沒適用我遇到的狀況。app

處理辦法this

  1. 編輯 {CATALINA-HOME}/conf/logging.properties 文件,在文件末尾添加:.net

    org.apache.jasper.servlet.TldScanner.level = FINE

    此處需注意,以前說的方法修改的是catalina.properties,而此處修改的是logging.propertiesdebug

  2. 重啓 Tomcatcode

  3. 在 {CATALINA-HOME}/logs/ 目錄下執行下面命令blog

    egrep "No TLD files were found in \[file:[^\]+\]" /var/log/tomcat7/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,\
  4. 將上面的結果放到**{CATALINA-HOME}/conf/catalina.properties**文件中的 tomcat.util.scan.StandardJarScanFilter.jarsToSkip= 處,保存該文件

    注意,此處是catalina.properties

  5. 刪除步驟1中在 logging.properties 中添加的org.apache.jasper.servlet.TldScanner.level = FINE

操做到這裏就完成了,能夠重啓Tomcat感覺一下,也許就能夠了。不過我這邊啓動的速度卻卡在了新的地方

org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory

這個問題參考另外一篇博客 燭✟孩

參考文檔:yasi_xi

相關文章
相關標籤/搜索