一尘不染

IllegalArgumentException:名为[com.staff.servlet.AllocationServlet]和[com.staff.servlet.SearchConditionServlet]的servlet都被映射[重复]

tomcat

当我尝试执行项目时,即使没有项目在运行,我也总是会收到此错误。我想摆脱这个问题。请帮帮我。解决方案是什么?我的控制台说

    Nov 27, 2013 8:54:38 PM org.apache.catalina.core.AprLifecycleListener init
    INFO: The APR based Apache Tomcat Native library which allows optimal performance  in production environments was not found on the java.library.path: C:\Program Files   (x86)\Java\jdk1.6.0_24\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Prog ram Files (x86)/Java/jdk1.6.0_24/bin/../jre/bin/client;C:/Program Files  (x86)/Java/jdk1.6.0_24/bin/../jre/bin;C:/Program Files  (x86)/Java/jdk1.6.0_24/bin/../jre/lib/i386;C:\Program Files  (x86)\Java\jdk1.6.0_24\bin;C:\Program Files (x86)\PC Connectivity  Solution\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Windo        wsPowerShell\v1.0\;;C:\Program Files (x86)\Samsung\Samsung PC Studio 3\;c:\Program  Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL  Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;c:\Program Files  (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;c:\Program Files  (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;c:\Program Files  (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\MySQL\MySQL Server  5.5\bin;C:\Program Files (x86)\QuickTime\QTSystem\
    Nov 27, 2013 8:54:38 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property  'source' to 'org.eclipse.jst.jee.server:staffs' did not find a matching property.
    Nov 27, 2013 8:54:38 PM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["http-bio-8080"]
    Nov 27, 2013 8:54:38 PM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
    Nov 27, 2013 8:54:38 PM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 753 ms
    Nov 27, 2013 8:54:38 PM org.apache.catalina.core.StandardService startInternal
    INFO: Starting service Catalina
    Nov 27, 2013 8:54:38 PM org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet Engine: Apache Tomcat/7.0.42
    Nov 27, 2013 8:54:39 PM org.apache.catalina.loader.WebappClassLoader  validateJarFile
    INFO:  validateJarFile(C:\Users\Ramya\workspace1\.metadata\.plugins\org.eclipse.wst.server.core\tm p0\wtpwebapps\staffs\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3,  section 9.7.2. Offending class: javax/servlet/Servlet.class
    Nov 27, 2013 8:54:39 PM org.apache.catalina.core.ContainerBase startInternal
    SEVERE: A child container failed during start
    java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException:  Failed to start component  [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/staffs]]
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
at java.util.concurrent.FutureTask.get(FutureTask.java:83)
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$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at  java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
at java.lang.Thread.run(Thread.java:662)
    Caused by: org.apache.catalina.LifecycleException: Failed to start component  [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/staffs]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
... 7 more
    Caused by: java.lang.IllegalArgumentException: The servlets named   [com.staff.servlet.AllocationServlet] and [com.staff.servlet.SearchConditionServlet] are  both mapped to the url-pattern [/AllocationServlet] which is not permitted
at org.apache.catalina.deploy.WebXml.addServletMapping(WebXml.java:335)
at  org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:24 50)
at  org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2132)
at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2093)
at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2086)
at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2086)
at  org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2086)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1293)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376)
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:5322)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
    Nov 27, 2013 8:54:39 PM org.apache.catalina.core.ContainerBase startInternal
    SEVERE: 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$Sync.innerGet(FutureTask.java:222)
at java.util.concurrent.FutureTask.get(FutureTask.java:83)
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:691)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at       sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)
    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$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at     java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
    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)
... 7 more
    Nov 27, 2013 8:54:39 PM org.apache.catalina.startup.Catalina start
    SEVERE: The required Server component failed to start so Tomcat is unable to 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:691)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)
    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
    Nov 27, 2013 8:54:39 PM org.apache.coyote.AbstractProtocol pause
    INFO: Pausing ProtocolHandler ["http-bio-8080"]
    Nov 27, 2013 8:54:39 PM org.apache.coyote.AbstractProtocol pause
    INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
    Nov 27, 2013 8:54:39 PM org.apache.catalina.core.StandardService stopInternal
    INFO: Stopping service Catalina
    Nov 27, 2013 8:54:39 PM org.apache.coyote.AbstractProtocol destroy
    INFO: Destroying ProtocolHandler ["http-bio-8080"]
    Nov 27, 2013 8:54:39 PM org.apache.coyote.AbstractProtocol destroy
    INFO: Destroying ProtocolHandler ["ajp-bio-8009"]

解决方案是什么?


阅读 111

收藏
2020-06-16

共1个答案

一尘不染

例外是不言自明的

作者:java.lang.IllegalArgumentException:名为[com.staff.servlet.AllocationServlet]和[com.staff.servlet.SearchConditionServlet]的servlet都映射到url模式[/
AllocationServlet],这是不允许的

看来您的两个servlet分别是

  1. 分配Servlet
  2. SearchConditionServlet

两者都映射到相同的url-pattern AllocationServlet

您需要修复servlet的web.xml或注解(在Servlet3.0的情况下),并确保没有两个servlet映射到相同的url模式。

2020-06-16