2012-01-04 15 views
14

Khi chạy ứng dụng JSF 2 của tôi trong nhật thực Tôi nhận được nhiều bản ghi thông tin mà TLD được bỏ qua bởi vì nó đã được xác định như sau:"INFO: TLD bị bỏ qua. URI đã được xác định" nghĩa là gì?

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 

Tôi tò mò muốn biết, những gì không log này nghĩa là gì?

+0

Vui lòng không đăng lại câu hỏi của bạn. – NullUserException

+2

bài đăng trùng lặp được liên kết đã bị xóa –

Trả lời

11

Điều này có nghĩa là bạn có các tệp TLD trùng lặp trong đường dẫn lớp thời gian chạy trên webapp của bạn. Vì các TLD thường được chứa trong các tệp JAR của thư viện, điều này có nghĩa là bạn có các tệp JAR trùng lặp trong đường dẫn lớp thời gian chạy của webapp.

Giả sử bạn chưa chạm vào thư mục /lib của máy chủ ứng dụng cũng như thư mục /lib của JDK, thì các bản sao đó nằm trong thư mục /WEB-INF/lib của bản dựng WAR. Dọn dẹp nó.

3

Thứ tự ưu tiên của các URI yêu cầu của spec là:

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 tải TLD hai lần.

1, khi Tomcat khởi động, nó tải tld để tìm người nghe trong tệp tld.

2, khi tệp jsp đầu tiên được biên soạn, nó tạo bộ nhớ cache của cặp tld.

1, tải TLD để tìm người nghe trong các tập tin tld

Khi tải từ web.xml, nó đặt taglib uri-từ web.xml và uri từ file tld thành một tập. Khi tải từ WEB-INF hoặc jar, uri là từ tập tin tld.

Tomcat cần tránh người nghe tld trùng lặp bổ sung, vì vậy, nó kiểm tra xem có tồn tại uri trong tập hợp hay không. Nếu uri đã tồn tại, nó ghi lại các tin nhắn bạn đăng và bỏ qua thêm trình nghe tld.

2, xây dựng bộ nhớ cache

1) mục web.xml, thẻ uri được nhận được từ web.xml

2) file tld quét dưới WEB-INF, thẻ uri được nhận được từ các tệp tld

3) lọ quét, thẻ uri được lấy từ tệp tld.

Nếu khu vực uri tồn tại, mục nhập sẽ bị bỏ qua.

0

Ví dụ: nếu bạn sử dụng Tomcat và Maven (hoặc các máy chủ khác) mà bạn gửi thư viện JSTL đã được tìm thấy trên máy chủ và máy chủ không phàn nàn.

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

Đồng thời bạn ứng dụng được triển khai (trên Tomcat) sau đó bạn nhận được thông báo lỗi:

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 

Giải pháp là sử dụng thẻ 'phạm vi' và giá trị của 'cung cấp' vì JSTL đã được vận chuyển với Tomcat (chỉ dành cho IDE của bạn):

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

Sau đó, lỗi sẽ biến mất.

Các vấn đề liên quan