title: java.lang.IllegalArgumentException: The servlets named [X] and [Y] are both mapped to the url-pattern [/url] which is not permitted
body: <p>I tried to add this servlet </p>
  
  <pre><code>package com.classmgt.servlet;
  
  @WebServlet("/ControllerServlet")
  public class ControllerServlet extends HttpServlet {}
  </code></pre>
  
  <p>to my Eclipse project, by editing the <code>web.xml</code> as below</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;description&gt;Servlet to print out Hello World!&lt;/description&gt;
      &lt;display-name&gt;ControllerServlet&lt;/display-name&gt;
      &lt;servlet-name&gt;ControllerServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;com.classmgt.servlet.ControllerServlet&lt;/servlet-class&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;ControllerServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/ControllerServlet&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>However, I got the following exception:</p>
  
  <pre><code>SEVERE: A child container failed during start
  java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ClassManagementSystem]]
      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.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[/ClassManagementSystem]]
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
      ... 7 more
  Caused by: java.lang.IllegalArgumentException: The servlets named [ControllerServlet] and [com.classmgt.servlet.ControllerServlet] are both mapped to the url-pattern [/ControllerServlet] which is not permitted
      at org.apache.catalina.deploy.WebXml.addServletMapping(WebXml.java:335)
      at org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:2457)
      at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2139)
      at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2100)
      at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2093)
      at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2093)
      at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2093)
      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:5269)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      ... 7 more
  </code></pre>
  
  <p>I have tried adding <code>metadata-complete="true"</code> to <code>web.xml</code>, but it does not recognize the servlet anymore.</p>