Tomcat启动失败,启动子级时出错 IllegalStateException,因为我们有相同的WebServlet注解配置路径,有两个相同的上下文路径,所以会报错。

03-Nov-2023 21:28:54.882 严重 [RMI TCP Connection(2)-127.0.0.1] org.apache.tomcat.util.modeler.BaseModelMBean.invoke 调用方法[manageApp]时发生异常
	java.lang.IllegalStateException: 启动子级时出错
		at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:686)
		at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:658)
		at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:713)
		at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1821)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
		at java.base/java.lang.reflect.Method.invoke(Method.java:568)
		at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:294)
		at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:814)
		at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:802)
		at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:428)
		at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:376)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
		at java.base/java.lang.reflect.Method.invoke(Method.java:568)
		at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:294)
		at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:814)
		at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:802)
		at java.management/com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:472)
		at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1472)
		at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1310)
		at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
		at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1412)
		at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
		at java.base/java.lang.reflect.Method.invoke(Method.java:568)
		at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
		at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
		at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
		at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
		at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
		at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
		at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
		at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
		at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
		at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
		at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
		at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
		at java.base/java.lang.Thread.run(Thread.java:833)
	Caused by: org.apache.catalina.LifecycleException: 无法启动组件[StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
		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:683)
		... 42 more
	Caused by: java.lang.IllegalArgumentException: 名为 [com.csdn.servlet.PostAxiosAjaxServlet]和 [com.csdn.servlet.SessionServlet] 的servlet不能映射为一个url模式(url-pattern) [/h10]
		at org.apache.tomcat.util.descriptor.web.WebXml.addServletMappingDecoded(WebXml.java:354)
		at org.apache.tomcat.util.descriptor.web.WebXml.addServletMapping(WebXml.java:347)
		at org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:2664)
		at org.apache.catalina.startup.ContextConfig.processClass(ContextConfig.java:2347)
		at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2336)
		at org.apache.catalina.startup.ContextConfig.processAnnotationsWebResource(ContextConfig.java:2237)
		at org.apache.catalina.startup.ContextConfig.processAnnotationsWebResource(ContextConfig.java:2231)
		at org.apache.catalina.startup.ContextConfig.processAnnotationsWebResource(ContextConfig.java:2231)
		at org.apache.catalina.startup.ContextConfig.processAnnotationsWebResource(ContextConfig.java:2231)
		at org.apache.catalina.startup.ContextConfig.processClasses(ContextConfig.java:1399)
		at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1304)
		at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:987)
		at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:304)
		at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
		at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4797)
		at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
		... 43 more
03-Nov-2023 21:28:54.885 严重 [RMI TCP Connection(2)-127.0.0.1] org.apache.tomcat.util.modeler.BaseModelMBean.invoke 调用方法[createStandardContext]时发生异常
	javax.management.RuntimeOperationsException: 调用方法[manageApp]时发生异常
		at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:304)
		at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:814)
		at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:802)
		at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:428)
		at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:376)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
		at java.base/java.lang.reflect.Method.invoke(Method.java:568)
		at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:294)
		at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:814)
		at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:802)
		at java.management/com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:472)
		at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1472)
		at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1310)
		at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
		at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1412)
		at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
		at java.base/java.lang.reflect.Method.invoke(Method.java:568)
		at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
		at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
		at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
		at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
		at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
		at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
		at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
		at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
		at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
		at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
		at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
		at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
		at java.base/java.lang.Thread.run(Thread.java:833)
	Caused by: java.lang.IllegalStateException: 启动子级时出错
		at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:686)
		at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:658)
		at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:713)
		at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1821)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
		at java.base/java.lang.reflect.Method.invoke(Method.java:568)
		at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:294)
		... 34 more
	Caused by: org.apache.catalina.LifecycleException: 无法启动组件[StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
		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:683)
		... 42 more
	Caused by: java.lang.IllegalArgumentException: 名为 [com.csdn.servlet.PostAxiosAjaxServlet]和 [com.csdn.servlet.SessionServlet] 的servlet不能映射为一个url模式(url-pattern) [/h10]
		at org.apache.tomcat.util.descriptor.web.WebXml.addServletMappingDecoded(WebXml.java:354)
		at org.apache.tomcat.util.descriptor.web.WebXml.addServletMapping(WebXml.java:347)
		at org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:2664)
		at org.apache.catalina.startup.ContextConfig.processClass(ContextConfig.java:2347)
		at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2336)
		at org.apache.catalina.startup.ContextConfig.processAnnotationsWebResource(ContextConfig.java:2237)
		at org.apache.catalina.startup.ContextConfig.processAnnotationsWebResource(ContextConfig.java:2231)
		at org.apache.catalina.startup.ContextConfig.processAnnotationsWebResource(ContextConfig.java:2231)
		at org.apache.catalina.startup.ContextConfig.processAnnotationsWebResource(ContextConfig.java:2231)
		at org.apache.catalina.startup.ContextConfig.processClasses(ContextConfig.java:1399)
		at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1304)
		at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:987)
		at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:304)
		at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
		at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4797)
		at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
		... 43 more
[2023-11-03 09:28:54,900] Artifact pro07-web:war: Error during artifact deployment. See server log for details.
03-Nov-2023 21:29:03.996 信息 [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [F:\develop\apache-tomcat-10.1.7-windows-x64\apache-tomcat-10.1.7\webapps\manager]
03-Nov-2023 21:29:04.220 信息 [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory Web应用程序目录[F:\develop\apache-tomcat-10.1.7-windows-x64\apache-tomcat-10.1.7\webapps\manager]的部署已在[224]毫秒内完成

Tomcat启动失败,启动子级时出错 IllegalStateException,因为我们有相同的WebServlet注解配置路径,有两个相同的上下文路径,所以会报错。_第1张图片

Tomcat启动失败,启动子级时出错 IllegalStateException,因为我们有相同的WebServlet注解配置路径,有两个相同的上下文路径,所以会报错。_第2张图片 

这是一个关于Tomcat启动Web项目时出现异常的报错信息。报错信息中提到了一个IllegalStateException异常,这个异常通常是由于Tomcat在启动子级时出现了错误导致的。具体来说,这个异常可能是由于以下原因引起的:

  • 应用程序的上下文路径已经存在于Tomcat中,但是Tomcat正在尝试将其添加到现有的上下文中。
  • 应用程序的上下文路径已经存在于Tomcat中,但是Tomcat正在尝试将其添加到现有的上下文中。
  • 应用程序的上下文路径已经存在于Tomcat中,但是Tomcat正在尝试将其添加到现有的上下文中。

解决这个问题的方法可能包括:

  • 检查Tomcat的日志文件,查看是否有其他错误或异常。
  • 检查应用程序的配置文件,确保没有重复的上下文路径。
  • 检查应用程序的依赖项,确保它们都正确地配置和部署。
  • 尝试重新启动Tomcat和应用程序,看看是否可以解决问题。

你可能感兴趣的:(#,Tomcat-Servlet,tomcat,Webservlet,urlPatterns)