web项目传classes目录项目正常,打包成jar不能运行。

笔者最近使用tomcat9,由于工作洁癖,盯上了tomcat启动日志里的"No TLD files were found in"字样,如下

15-Sep-2017 02:19:09.685 FINE [main] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/home/tomcat9/webapps/xxx/WEB-INF/lib/z-1.1.3.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.

于是按照以下stackoverflow两篇文章进行优化

How to fix “JARs that were scanned but no TLDs were found in them ” in Tomcat 9.0.0M10

How to fix JSP compiler warning: one JAR was scanned for TLDs yet contained no TLDs?

把z-1.1.3.jar添加到了${catalina.base}/conf/catalina.properties里面,如下

tomcat.util.scan.StandardJarScanFilter.jarsToSkip=z-1.1.3.jar

结果吧z-1.1.3.jar每次上传到WEB_INF/lib/目录下tomcat都能正常运行,可是与预期的结果不一致,最终经过排查发现了这个原因。

解决方法:把z-1.1.3.jar从jarSkip去掉重启tomcat即可。

其他资源:

Logging in Tomcat tomcat全局日志记录与web应用日志记录

原文地址:https://www.cnblogs.com/passedbylove/p/7527522.html