什么是“INFO:TLD跳过.URI已定义”是什么意思?

时间:2012-01-04 09:14:30

标签: java-ee jsf-2 tomcat7 taglib

在eclipse中运行我的JSF 2应用程序时 我收到了几个TLD被跳过的信息日志,因为它已经定义如下:

Jan 3, 2012 7:24:45 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://www.springframework.org/tags/form is already defined
Jan 3, 2012 7:24:45 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://www.springframework.org/tags is already defined
Jan 3, 2012 7:24:45 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined
Jan 3, 2012 7:24:45 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core is already defined
Jan 3, 2012 7:24:45 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined
Jan 3, 2012 7:24:45 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined
Jan 3, 2012 7:24:45 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined
Jan 3, 2012 7:24:45 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined
Jan 3, 2012 7:24:45 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined
Jan 3, 2012 7:24:45 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined
Jan 3, 2012 7:24:45 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined
Jan 3, 2012 7:24:45 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined
Jan 3, 2012 7:24:45 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined
Jan 3, 2012 7:24:45 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined
Jan 3, 2012 7:24:45 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined
Jan 3, 2012 7:24:45 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined
Jan 3, 2012 7:24:45 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined

我很想知道,这个日志是什么意思?

3 个答案:

答案 0 :(得分:11)

这意味着您在webapp的运行时类路径中有重复的TLD文件。由于TLD通常包含在库JAR文件中,这反过来意味着您在webapp的运行时类路径中有重复的JAR文件。

假设您没有触及appserver的/lib文件夹或JDK的/lib文件夹,那么这些重复文件位于WAR版本的/WEB-INF/lib文件夹中。清理它。

答案 1 :(得分:3)

规范要求的URI的优先顺序是:

J2EE platform taglibs - Tomcat doesn't provide these

web.xml entries

JARS in WEB-INF/lib & TLDs under WEB-INF (equal priority)

Additional entries from the container

Tomcat加载tld两次。

1,当Tomcat启动时,它会加载tld以在tld文件中找到侦听器。

2,当编译第一个jsp文件时,它会构建一个tld对的缓存。

1,加载tld以在tld文件中查找侦听器

从web.xml加载时,它将来自web.xml的taglib-uri和来自tld文件的uri放入一个集合中。 从WEB-INF或jar加载时,uri来自tld文件。

Tomcat需要避免重复的tld侦听器添加,因此它会检查集合中是否存在uri。如果uri已经存在,则记录您发布的消息并跳过添加tld监听器。

2,构建缓存

1)web.xml条目,标签uri来自web.xml

2)扫描WEB-INF下的tld文件,标签uri来自tld文件

3)扫描罐子,标签uri来自tld文件。

如果存在uri,则该条目将被忽略。

答案 2 :(得分:1)

这意味着,例如,如果您使用Tomcat和Maven(或其他服务器),您运送已在服务器上找到的JSTL库,并且服务器会抱怨。

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

在部署应用程序时(在Tomcat上),您会收到错误消息:

INFO: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined
Mar 02, 2017 2:19:32 PM org.apache.catalina.startup.TaglibUriRule body

解决方案是使用标记&#39;范围&#39;以及提供的值#39;因为JSTL已经随Tomcat一起提供(它仅适用于您的IDE):

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
        <scope>provided</scope>
    </dependency>

然后错误就会消失。