0

When ever I try to execute certain files in my Project I get this error

"Server Tomcat v7.0 Server at localhost failed to start"

The console shows following errors

Caused by: java.lang.IllegalArgumentException: The servlets named [AdminValidate] and [com.kunal.servlet.AdminValidate] are both mapped to the url-pattern [/AdminValidate] which is not permitted
    at org.apache.catalina.deploy.WebXml.addServletMapping(WebXml.java:293)
    at org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:2396)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2072)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2033)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2026)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2026)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2026)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1291)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:876)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:374)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5378)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 6 more

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>Agro</display-name>
  <servlet>
   <display-name>AdminValidate</display-name>
   <servlet-name>AdminValidate</servlet-name>
   <servlet-class>com.kunal.servlet.AdminValidate</servlet-class>
  </servlet>
  <servlet-mapping>
   <servlet-name>AdminValidate</servlet-name>
   <url-pattern>/AdminValidate</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>

I tried all the solution on stackoverflow but nothing seems to help...if there is any other solution to this problem please post here.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
user3834217
  • 11
  • 1
  • 1
  • 7

1 Answers1

0

Comments have provided the answers, still i would like to post as an answer

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

How would you expect the container to choose one servlet for an URL, when you have provided more than one servlet for the same URL pattern?

Please check the web.xml for more than one servlet mapped to the same URL pattern.

Think.

Keerthivasan
  • 12,760
  • 2
  • 32
  • 53
  • Thank you...error solved.....but now I an getting HTTP Status 500 - java.lang.NoSuchMethodError: javax.el.ExpressionFactory.newInstance()Ljavax/el/ExpressionFactory; – user3834217 Aug 08 '14 at 06:22
  • The method `javax.el.ExpressionFactory.newInstance()` is part of EL 2.2. so, you need to use a servlet container which supports it. Which tomcat version do you use? – Keerthivasan Aug 08 '14 at 06:28
  • It supports EL 2.2. Not sure why it happens, please check if you have any EL 2.1 jar version in classpath.. – Keerthivasan Aug 08 '14 at 06:33
  • Thank you bro......both problem solved....I had added the wrong jar.... – user3834217 Aug 08 '14 at 06:40