2

I am getting the below error when I start tomcat from eclipse

Sep 14, 2013 4:18:03 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\Java\jre1.6.0\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.6.0/bin/client;C:/Program Files/Java/jre1.6.0/bin;C:/Program Files/Java/jre1.6.0/lib/i386;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\MySQL\MySQL Server 5.0\bin;C:\eclipse;
    Sep 14, 2013 4:18:03 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:TestProject' did not find a matching property.
    Sep 14, 2013 4:18:03 PM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["http-bio-8080"]
    Sep 14, 2013 4:18:03 PM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
    Sep 14, 2013 4:18:03 PM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 420 ms
    Sep 14, 2013 4:18:03 PM org.apache.catalina.core.StandardService startInternal
    INFO: Starting service Catalina
    Sep 14, 2013 4:18:03 PM org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet Engine: Apache Tomcat/7.0.42
    Sep 14, 2013 4:18:03 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[/TestProject]]
        at java.util.concurrent.FutureTask$Sync.innerGet(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$Sync.innerRun(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(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[/TestProject]]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
        ... 7 more
    Caused by: java.lang.IllegalArgumentException: The servlets named [HelloWorlds] and [Hello] are both mapped to the url-pattern [/sHelloWorld] which is not permitted
        at org.apache.catalina.deploy.WebXml.addServletMapping(WebXml.java:335)
        at org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:2450)
        at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2132)
        at org.apache.catalina.startup.ContextConfig.processAnnotationsJndi(ContextConfig.java:2055)
        at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1962)
        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: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
    Sep 14, 2013 4:18:03 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(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:691)
        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: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(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(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)
        ... 7 more
    Sep 14, 2013 4:18:03 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(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: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
    Sep 14, 2013 4:18:03 PM org.apache.coyote.AbstractProtocol pause
    INFO: Pausing ProtocolHandler ["http-bio-8080"]
    Sep 14, 2013 4:18:03 PM org.apache.coyote.AbstractProtocol pause
    INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
    Sep 14, 2013 4:18:03 PM org.apache.catalina.core.StandardService stopInternal
    INFO: Stopping service Catalina
    Sep 14, 2013 4:18:03 PM org.apache.coyote.AbstractProtocol destroy
    INFO: Destroying ProtocolHandler ["http-bio-8080"]s
    Sep 14, 2013 4:18:03 PM org.apache.coyote.AbstractProtocol destroy
    INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Did you see this error `The servlets named [HelloWorlds] and [Hello] are both mapped to the url-pattern [/sHelloWorld] which is not permitted`? – A4L Sep 14 '13 at 11:16
  • HelloWorlds Hello HelloWorlds /sHelloWorld – Himanshu Khurana Sep 14 '13 at 11:17
  • url mappings should not affect the start of tomcat – Juned Ahsan Sep 14 '13 at 11:18
  • check this: http://tomcat.apache.org/native-doc/ – Juned Ahsan Sep 14 '13 at 11:18
  • When I starts server from command prompt it gives the following: Using CATALINA_BASE: "C:\apache-tomcat" Using CATALINA_HOME: "C:\apache-tomcat" Using CATALINA_TMPDIR: "C:\apache-tomcat\temp" Using JRE_HOME: "C:\Program Files\Java\jdk1.6.0\" Using CLASSPATH: "C:\apache-tomcat\bin\bootstrap.jar;C:\apache-tomcat\bin\ tomcat-juli.jar" C:\apache-tomcat\bin> – Himanshu Khurana Sep 14 '13 at 11:28

2 Answers2

3

This is a new feature of the version 7.0.42 of the apache tomcat servlet conainer.

I just made a test with the following web.xml

  <servlet>
    <description></description>
    <display-name>Servlet_01</display-name>
    <servlet-name>Servlet_01</servlet-name>
    <servlet-class>so.servlets.Servlet_01</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Servlet_01</servlet-name>
    <url-pattern>/Servlet_01</url-pattern>
  </servlet-mapping>

  <servlet>
    <description></description>
    <display-name>Servlet_02</display-name>
    <servlet-name>Servlet_02</servlet-name>
    <servlet-class>so.servlets.Servlet_02</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Servlet_02</servlet-name>
    <url-pattern>/Servlet_01</url-pattern>
  </servlet-mapping>

and got exactly the same erros as you

The servlets named [Servlet_01] and [Servlet_02] are both mapped to the url-pattern [/Servlet_01] which is not permitted

The same Test with an earlier version - namely 7.0.32 - did not cause any error on the start of the context.

So apprarently you have two servlets HelloWorlds and Hello both mapped to the same url /sHelloWorld. The web.xml you have pasted in your comment is most likely not the right one.

The effect in the version 7.0.32 is that all request intended to go to Servlet_01 will actually go to Servlet_02. So I would say it's a good thing that now tomcat throws an error when it find such a erroneous mapping in a context.

The error happens even if you have the same servlet with two different names mapped to the same url pattern.

To solve your problem, first find the right web.xml and edit it so that each servlet has a distinct url mapping.

A4L
  • 17,353
  • 6
  • 49
  • 70
  • thanks it is very help-full. but one thing I want to confirm servlet-name and class-name should be same. bcoz when I use same name for servlet-name and class-name it works and when i give the servlet-name different it gives the same error. – Himanshu Khurana Sep 14 '13 at 11:57
  • @HimanshuKhurana, You're welcome! But note that `servlet-name` is not required to be the same as `servlet-class`, the first is just a logical name which helps referencing the servlet in an easier way, for example when configuring url-mapping. The second has to be the fully qualified name of the servlet class - i.e. `.` - and you have no play room in choosing it. In my example web.xml `so.servlets.Servlet_01` is the fully qualified name of the servlet class `Servlet_01` contained in the package `so.servlets.`. – A4L Sep 14 '13 at 16:46
0

The cause could be mixing of annotation and declarative configuration. Give a look at java.lang.IllegalArgumentException: The servlets named [X] and [Y] are both mapped to the url-pattern [/url] which is not permitted

Community
  • 1
  • 1
Lefteris Laskaridis
  • 2,292
  • 2
  • 24
  • 38