File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 1018
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>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invalid url pattern for filter in web.xml