欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

More than one fragment with the name [spring_web] was found.

程序员文章站 2022-07-13 14:54:33
...

项目跑的好好的。突然之间报错,不能tomcat启动。

报错如下:

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

 

  不知所云,无从下手。

  解决方案如下:

     add <absolute-ordering /> tag to your web.xml just under the <display-name> tag. should work.

    在web.xml 文件的<display-name>的元素后面增加 <absolute-ordering/> 元素。如下:

 

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

 

  问题解决。。。tomcat成功启动。