Khắc phục lỗi More than one fragment with the name [spring_web] was found

Đôi khi các bạn import từ một dư án khác vào, hoặc run dự án lên có thể nhìn tháy lỗi More than one fragment with the name [spring_web] was found. Lỗi này thường xảy ra khi có một file jar từ thư viện nào đó của spring đang sử dụng cũng có tên triển khai là spring_web. Để khắc phục lỗi này các bạn sẽ làm hướng dẫn như bên dưới bài viết.

Đầu tiên đây là lỗi

Caused by: java.lang.IllegalArgumentException: More than one fragment with the name [spring_web] was found. This is not legal with relative ordering. See section 8.2.2 2c of the Servlet specification for details. Consider using absolute ordering.
	at org.apache.tomcat.util.descriptor.web.WebXml.orderWebFragments(WebXml.java:2257)
	at org.apache.tomcat.util.descriptor.web.WebXml.orderWebFragments(WebXml.java:2215)
	at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1127)
	at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:768)
	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:301)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5048)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	... 27 more

 

Khắc phục lỗi

Để khắc phục lỗi trên các bạn cần làm như sau:

Thêm mã code này

<absolute-ordering /> trong fileweb.xmlvà đặt bên dưới thẻ <display-name> của bạn. và thử chạy lại, nó sẽ hoặt động.:

<display-name>XXX</display-name>
<absolute-ordering/>

 

Chúc các bạn khắc phục lỗi thành công!

 

0 0 đánh giá
Đánh giá bài viết
Theo dõi
Thông báo của
guest
0 Góp ý
Phản hồi nội tuyến
Xem tất cả bình luận
x