More than one fragment with the name [spring_web] was found[已解决]

本文详细解析了在部署Spring Web应用时遇到的碎片名称冲突问题,提供了在web.xml中加入<absolute-ordering/>标签的解决方案,有效避免了相对排序引发的异常。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

报错的问题:
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

在此错误前,还要子容器报错等错误,因为开始一直在查子容器报错的解决方案,导致总是不在根本解决问题,所以,一直烦恼了好久,最后还不得已换了eclipse和Tomcat,最后还是存在这个问题。后来就着眼于这个问题,最后找到了解决的方案。

解决方案:
在web.xml中的</display-name>后加上<absolute-ordering/>代码就解决了。

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值