0

I have installed tomcat server to work with my dynamic web project on eclipse Luna. The server seems to be running fine when I dont load it with any project file but when I load my project it gives the error "Server Tomcat v7.0 Server at localhost failed to start." I have checked my project and there seems to be no error in it. These are the server startup messages that I get:

Caused by: java.lang.IllegalArgumentException: Invalid <url-pattern> WelcomeServlet in servlet mapping
    at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3325)
    at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3300)
    at org.apache.catalina.deploy.WebXml.configureContext(WebXml.java:1438)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1357)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:889)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:386)
    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:5419)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 6 more
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
masterfly
  • 861
  • 4
  • 11
  • 24

2 Answers2

0

You used incorrect syntax for the url pattern of the WelcomeServlet. Make it <url-pattern>/WelcomeServlet</url-pattern>. I added a / before the name of the Servlet.

cbender
  • 2,231
  • 1
  • 14
  • 18
0

Servlet mapping can be defined two ways:

  • <servlet-name> for Named Servlets
  • <url-pattern> for url patterns.

Using servlet-name

<servlet-mapping>
    <servlet-name>WelcomeServlet</servlet-name>
</servlet-mapping>

OR

Using url-pattern

<servlet-mapping>
    <url-pattern>/WelcomeServlet</url-pattern>
</servlet-mapping>

If you are interested in knowing the rules for url-pattern, Refere here

Community
  • 1
  • 1
Ramesh PVK
  • 15,200
  • 2
  • 46
  • 50