At least one JAR was scanned for TLDs yet contained no TLDs.问题解决方式

在执行时web项目是遇到了
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.
问题原因:Tomcat7/Servlet3.0 新增特性“可插性支持”实现的原理应该是自动扫描jar,当jar中并不包含相关组件时会打印该信息。
从提示信息来看,不处理也可以,但是因为我们需要看日志来检查程序的具体执行情况(如果没有报其他错误,说明程序正常),所以会产生一些不方便,而且作为一个有洁癖的程序员,怎么能允许这种东西出现在我的代码中。
解决方式
1.调整Tomcat对应类的log级别

修改${tomcat}/conf/log4j.properties

Java代码 收藏代码
##解除类org.apache.jasper.compiler.TldLocationsCache的log
org.apache.jasper.compiler.TldLocationsCache.level = FINE

2.观察Tomcat日志打印信息

步骤1执行完后,重启Tomcat,观察Tomcat日志,会在日志中发现类似如下打印信息:

Java代码 收藏代码
九月 09, 2013 10:55:37 上午 org.apache.jasper.compiler.TldLocationsCache tldScanJar
详细: No TLD files were found in [file:/E:/devspace/xxt_login/WEB-INF/lib/json-lib-2.3-jdk15.jar]. Consider adding the JAR to the tomcat.util.scan.DefaultJarScanner.jarsToSkip or org.apache.catalina.startup.TldConfig.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.
九月 09, 2013 10:55:37 上午 org.apache.jasper.compiler.TldLocationsCache tldScanJar
详细: No TLD files were found in [file:/E:/devspace/xxt_login/WEB-INF/lib/poi-3.8.jar]. Consider adding the JAR to the tomcat.util.scan.DefaultJarScanner.jarsToSkip or org.apache.catalina.startup.TldConfig.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.

3.调整${tomcat}/conf/catalina.properties,将提示的jar添加到不扫描清单中

Java代码 收藏代码
tomcat.util.scan.DefaultJarScanner.jarsToSkip=\
bootstrap.jar,commons-daemon.jar,tomcat-juli.jar,\
annotations-api.jar,el-api.jar,jsp-api.jar,servlet-api.jar,\
catalina.jar,catalina-ant.jar,catalina-ha.jar,catalina-tribes.jar,\
jasper.jar,jasper-el.jar,ecj-.jar,\
tomcat-api.jar,tomcat-util.jar,tomcat-coyote.jar,tomcat-dbcp.jar,\
tomcat-jni.jar,tomcat-spdy.jar,\
tomcat-i18n-en.jar,tomcat-i18n-es.jar,tomcat-i18n-fr.jar,tomcat-i18n-ja.jar,\
tomcat-juli-adapters.jar,catalina-jmx-remote.jar,catalina-ws.jar,\
tomcat-jdbc.jar,\
tools.jar,\
commons-beanutils
.jar,commons-codec*.jar,commons-collections*.jar,\
commons-dbcp*.jar,commons-digester*.jar,commons-fileupload*.jar,\
commons-httpclient*.jar,commons-io*.jar,commons-lang*.jar,commons-logging*.jar,\
commons-math*.jar,commons-pool*.jar,\
jstl.jar,\
geronimo-spec-jaxrpc*.jar,wsdl4j*.jar,\
ant.jar,ant-junit*.jar,aspectj*.jar,jmx.jar,h2*.jar,hibernate*.jar,httpclient*.jar,\
jmx-tools.jar,jta*.jar,log4j*.jar,mail*.jar,slf4j*.jar,\
xercesImpl.jar,xmlParserAPIs.jar,xml-apis.jar,\
junit.jar,junit-.jar,ant-launcher.jar,\
json-lib-
.jar,poi-*.jar

你可能感兴趣的:(java,编程)