关于SpringMVC报错“More than one fragment with the name [org_apache_tomcat_websocket] was found. This is”

springMVC项目启动时报错

java.lang.IllegalStateException: Error starting child
	
	
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
	
Caused by: java.lang.IllegalArgumentException: More than one fragment with the name [org_apache_tomcat_websocket] 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.
	

23-Sep-2020 16:37:43.364 涓ラ噸 [RMI TCP Connection(3)-127.0.0.1] org.apache.tomcat.util.modeler.BaseModelMBean.invoke Exception invoking method [createStandardContext]
 javax.management.RuntimeOperationsException: Exception invoking method [manageApp]
	
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
	
Caused by: java.lang.IllegalArgumentException: More than one fragment with the name [org_apache_tomcat_websocket] 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.
	

[2020-09-23 04:37:43,388] Artifact springMVC:war exploded: Error during artifact deployment. See server log for details.

解决方法
在web.xml文件末尾加上:<absolute-ordering />

 <servlet-mapping>
        <servlet-name>spring_mvc</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
    <absolute-ordering />
</web-app>

导致这个问题出现的根本原因是某个jar包使得项目中出现了超过一个web片段(web fragment),关于web片段这个概念的理解,个人理解如下(仅供参考):

  • web片段是一个web项目中的组成部分,这个组成部分可以和其他web片段共同实现web的功能。
  • servlet3.0引入了web片段的支持,如果在servlet3.0中使用多个web片段,需要加入绝对排序标签。
    关于web片段详细可参考:https://blog.csdn.net/pursueexcellence/article/details/89981690
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值