maven创建Web项目启动错误The servlets named [X] and [Y] are both mapped to the url-pattern [/DemoServlet]

  • Post author:
  • Post category:其他



严重: A child container failed during start

java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/mvn_web_test]]



at java.util.concurrent.FutureTask.report(Unknown Source)



at java.util.concurrent.FutureTask.get(Unknown Source)



at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)



at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)



at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)



at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)



at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)



at java.util.concurrent.FutureTask.run(Unknown Source)



at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)



at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)



at java.lang.Thread.run(Unknown Source)

Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/mvn_web_test]]



at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)



… 6 more

Caused by: java.lang.IllegalArgumentException: The servlets named [DemoServlet] and [com.ljb.study.DemoServlet] are both mapped to the url-pattern [/DemoServlet] which is not permitted



at org.apache.catalina.deploy.WebXml.addServletMapping(WebXml.java:335)



at org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:2412)



at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2125)



at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2080)



at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2073)



at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2073)



at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2073)



at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1300)



at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)



at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)



at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)



at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)



at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5179)



at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)



… 6 more

六月 05, 2017 3:34:43 下午 org.apache.catalina.core.ContainerBase startInternal

严重: A child container failed during start

java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]



at java.util.concurrent.FutureTask.report(Unknown Source)



at java.util.concurrent.FutureTask.get(Unknown Source)



at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)



at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)



at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)



at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)



at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)



at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)



at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)



at org.apache.catalina.startup.Catalina.start(Catalina.java:684)



at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)



at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)



at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)



at java.lang.reflect.Method.invoke(Unknown Source)



at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)



at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)

Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]



at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)



at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)



at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)



at java.util.concurrent.FutureTask.run(Unknown Source)



at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)



at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)



at java.lang.Thread.run(Unknown Source)

Caused by: org.apache.catalina.LifecycleException: A child container failed during start



at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)



at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)



at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)



… 6 more

六月 05, 2017 3:34:43 下午 org.apache.catalina.startup.Catalina start

严重: Catalina.start:

org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]



at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)



at org.apache.catalina.startup.Catalina.start(Catalina.java:684)



at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)



at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)



at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)



at java.lang.reflect.Method.invoke(Unknown Source)



at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)



at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)

Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]



at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)



at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)



at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)



… 7 more

Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]



at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)



at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)



at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)



… 9 more

Caused by: org.apache.catalina.LifecycleException: A child container failed during start



at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)



at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)



at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)



… 11 more

六月 05, 2017 3:34:43 下午 org.apache.catalina.startup.Catalina start

信息: Server startup in 4523 ms

原因是使用了servlet3.0,默认采用了注解方式申明url,所以不用在web.xml里再加 <servlet>配置。



版权声明:本文为mike__cool原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。