Reputation: 592
I've created very simple REST app with next web.xml:
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>true</param-value>
</context-param>
<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
I'm using servlet 3.0 specification and Tomcat 7.0.23. Unfortunately it fails all time:
Caused by: java.lang.IllegalArgumentException: Filter mapping must specify either a <url-pattern> or a <servlet-name>
at org.apache.catalina.core.StandardContext.validateFilterMap(StandardContext.java:2995)
at org.apache.catalina.core.StandardContext.addFilterMap(StandardContext.java:2954)
I don't imagine where problem is... I don't use filters in my code, how can I fix it?
Upvotes: 7
Views: 5050
Reputation: 24437
It's a bug in Tomcat 7 (version < 7.0.28), see that reply to a similar question, and the linked Tomcat 7 bugzilla ticket.
Upvotes: 0
Reputation: 1539
Of course, adding 'metadata-complete="true"' will block any other jars from contributing to web.xml, including RichFaces and Seam. It is better to exclude the offending JAR file from your deployment. In my case, it was the async-http-servlet-3.0-2.3.3.Final.jar who offended.
Upvotes: 0
Reputation: 1109132
This is related to RESTEasy issue 577. To fix this, you need to add metadata-complete="true"
to the <web-app>
root declaration of your /WEB-INF/web.xml
.
<web-app
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0" metadata-complete="true">
<!-- Config here. -->
</web-app>
This way Tomcat will assume that the /WEB-INF/web.xml
is complete and won't scan JARs for additional metadata information in web.xml
fragments which in case of RESTEasy apparently contain incorrectly/incompletely declared filters.
Upvotes: 12