Tomcat部署报错:org.apache.catalina.LifecycleException: 无法启动组件[StandardEngine[Catalina].StandardHost[/**]

报错内容

17-May-2022 17:36:34.786 信息 [main] org.apache.catalina.core.StandardEngine.startInternal 正在启动 Servlet 引擎:[Apache Tomcat/8.5.78]
17-May-2022 17:36:34.811 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [/usr/local/apache-tomcat-8.5.78/webapps/project]
17-May-2022 17:36:35.019 严重 [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: 
	org.apache.catalina.LifecycleException: 无法启动组件[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/project]]
		at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
		at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
		at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753)
		at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:727)
		at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
		at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1177)
		at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1925)
		at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
		at java.util.concurrent.FutureTask.run(FutureTask.java:266)
		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
		at java.lang.Thread.run(Thread.java:748)
	Caused by: java.lang.IllegalArgumentException: 找到多个名为spring_web的片段。这是不合法的相对排序。有关详细信息,请参阅Servlet规范的第8.2.2 2c节。考虑使用绝对排序。
		at org.apache.tomcat.util.descriptor.web.WebXml.orderWebFragments(WebXml.java:2206)
		at org.apache.tomcat.util.descriptor.web.WebXml.orderWebFragments(WebXml.java:2164)
		at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1084)
		at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:779)
		at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:299)
		at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
		at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5130)
		at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
		... 10 more
17-May-2022 17:36:35.020 严重 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory 无法部署应用目录 [/usr/local/apache-tomcat-8.5.78/webapps/project]
	java.lang.IllegalStateException: 启动子级时出错
		at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:757)
		at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:727)
		at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
		at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1177)
		at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1925)
		at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
		at java.util.concurrent.FutureTask.run(FutureTask.java:266)
		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
		at java.lang.Thread.run(Thread.java:748)
	Caused by: org.apache.catalina.LifecycleException: 无法启动组件[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/project]]
		at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
		at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
		at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753)
		... 9 more
	Caused by: java.lang.IllegalArgumentException: 找到多个名为spring_web的片段。这是不合法的相对排序。有关详细信息,请参阅Servlet规范的第8.2.2 2c节。考虑使用绝对排序。
		at org.apache.tomcat.util.descriptor.web.WebXml.orderWebFragments(WebXml.java:2206)
		at org.apache.tomcat.util.descriptor.web.WebXml.orderWebFragments(WebXml.java:2164)
		at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1084)
		at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:779)
		at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:299)
		at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
		at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5130)
		at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
		... 10 more
17-May-2022 17:36:35.028 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Web应用程序目录[/usr/local/apache-tomcat-8.5.78/webapps/project]的部署已在[209]毫秒内完成
17-May-2022 17:36:35.028 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [/usr/local/apache-tomcat-8.5.78/webapps/docs]
17-May-2022 17:36:35.165 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Web应用程序目录[/usr/local/apache-tomcat-8.5.78/webapps/docs]的部署已在[137]毫秒内完成
17-May-2022 17:36:35.165 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [/usr/local/apache-tomcat-8.5.78/webapps/manager]
17-May-2022 17:36:35.186 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Web应用程序目录[/usr/local/apache-tomcat-8.5.78/webapps/manager]的部署已在[21]毫秒内完成
17-May-2022 17:36:35.186 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [/usr/local/apache-tomcat-8.5.78/webapps/examples]

重点:Caused by: java.lang.IllegalArgumentException: 找到多个名为spring_web的片段。这是不合法的相对排序。有关详细信息,请参阅Servlet规范的第8.2.2 2c节。考虑使用绝对排序。

环境版本

17-May-2022 17:36:34.096 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server.服务器版本: Apache Tomcat/8.5.78
17-May-2022 17:36:34.143 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 服务器构建:        Mar 31 2022 16:05:28 UTC
17-May-2022 17:36:34.143 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 服务器版本号:      8.5.78.0
17-May-2022 17:36:34.143 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 操作系统名称:      Mac OS X
17-May-2022 17:36:34.143 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS.版本:           10.16
17-May-2022 17:36:34.143 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 架构:              x86_64
17-May-2022 17:36:34.144 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java 环境变量:     /Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/jre
17-May-2022 17:36:34.144 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java虚拟机版本:    1.8.0_261-b12
17-May-2022 17:36:34.144 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM.供应商:        Oracle Corporation

问题解决

Servelet 规范文档

在项目的WEB-INF目录下找到web.xml文件 添加 absolute-ordering 标签重启Tomcat 即可解决问题


<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="schedule-console" version="3.0">
   
  <absolute-ordering/>
  <servlet>
    <servlet-name>springmvcservlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServletservlet-class>
    <init-param>
      <param-name>contextConfigLocationparam-name>
      <param-value>classpath:/applicationContext*.xmlparam-value>
    init-param>
  servlet>
  <servlet>
    <servlet-name>ShowPicServletservlet-name>
    <servlet-class>pic.ShowPicServletservlet-class>
  servlet>
  <servlet-mapping>
    <servlet-name>springmvcservlet-name>
    <url-pattern>*.actionurl-pattern>
  servlet-mapping>
  <servlet-mapping>
    <servlet-name>ShowPicServletservlet-name>
    <url-pattern>/ShowPicServleturl-pattern>
  servlet-mapping>
  <filter>
    <filter-name>characterEncodingfilter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilterfilter-class>
    <init-param>
      <param-name>encodingparam-name>
      <param-value>utf-8param-value>
    init-param>
  filter>
  <filter-mapping>
    <filter-name>characterEncodingfilter-name>
    <url-pattern>/*url-pattern>
  filter-mapping>
  <welcome-file-list>
    <welcome-file>index.jspwelcome-file>
  welcome-file-list>
web-app>


你可能感兴趣的:(tomcat,apache,java)