Posted in Software Engineering, web application

Invalid servlet mapping in tomcat

A common exception ,”Invalid <url-pattern> servlet mapping” when deploying application server in tomcat. 
The url-pattern specification:
  • A string beginning with a ‘/’ character and ending with a ‘/*’ suffix is used for path mapping.
  • A string beginning with a ‘*.’ prefix is used as an extension mapping.
  • A string containing only the ’/’ character indicates the “default” servlet of the application. In this case the servlet path is the request URI minus the context path and the path info is null.
  • All other strings are used for exact matches only.

invalid web.xml:

<servlet>    <servlet-name>remoteLoggingServlet</servlet-name>    <servlet-class>com.google.gwt.logging.server.RemoteLoggingServiceImpl</servlet-class>  </servlet>    <servlet-mapping>    <servlet-name>remoteLoggingServlet</servlet-name>    <url-pattern>mweb/remote_logging</url-pattern>  </servlet-mapping>   

valid web.xml:

 <servlet>    <servlet-name>remoteLoggingServlet</servlet-name>    <servlet-class>com.google.gwt.logging.server.RemoteLoggingServiceImpl</servlet-class>  </servlet>    <servlet-mapping>    <servlet-name>remoteLoggingServlet</servlet-name>    <url-pattern>/mweb/remote_logging/*</url-pattern>  </servlet-mapping>   

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s