*
The moose likes JSP and the fly likes Invalid url pattern for filter in web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Invalid url pattern for filter in web.xml" Watch "Invalid url pattern for filter in web.xml" New topic
Author

Invalid url pattern for filter in web.xml

Allen Williams
Ranch Hand

Joined: Sep 04, 2006
Posts: 136
I am trying to write my first filter. I want it to check all jsp pages (well, as a first pass, anyway). I am getting a bad url-pattern message from tomcat regarding my web.xml file. Here is the mapping:


This app is named smsinfo, and I have also tried:

Is there something really obvious I'm missing? Or, is there more information one needs to figure out why this is getting a bad url error?

The germane error from the traceback in catalina.out is:

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
Caused by: java.lang.IllegalArgumentException: Invalid <url-pattern> /*.jsp in filter mapping
at org.apache.catalina.core.StandardContext.addFilterMap(StandardContext.java:2078)
... 35 more
Oct 15, 2006 4:15:21 PM org.apache.catalina.startup.ContextConfig applicationWebConfig
SEVERE: Parse error in application web.xml file at jndi:/localhost/smsinfo/WEB-INF/web.xml
java.lang.IllegalArgumentException: Invalid <url-pattern> /*.jsp in filter mapping
at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2725)


Thanks!


-------<br />Thanks & regards,<br />anw
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1016
Refer to Section 11.2 of the Servlet Specification

In the web application deployment descriptor, the following syntax is used to define
mappings:
� A string beginning with a �/� character and ending with a �/*� postfix 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.

Try it without the initial /
ie: <url-pattern>*.jsp</url-pattern>
 
Don't get me started about those stupid light bulbs.
 
subject: Invalid url pattern for filter in web.xml
 
Similar Threads
web.xml deployment problem
web.xml template - very important for exam
Tomcat 4: web.xml url-pattern question...
404 in using acegi security with Spring
JSF 1.1 and Tomcat 6