tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maria petrova <>
Subject Why @WebServlet annotation is not processed when web.xml is version 2.5?
Date Tue, 17 Apr 2012 12:48:01 GMT

We’ve embedded Tomcat 7.0.26 in our product and we are currently trying to
cover Servlet 3.0 CTS with it.  We’ve encountered the following problem
with one of the tests.

Though the version of the web deployment descriptor of the test application
is 2.5, there is a servlet annotated with *@WebServlet *annotation and
requests to this servlet are responded with 404 Not Found. When I change
the version of the web.xml to 3.0 everything works just fine.

In Chapter *“1.6.2 Regarding Processing annotations”* in the Servlet 3.0
Specification it is said that:

*“The version of the descriptor MUST not affect which annotations you scan
for in a web application.”*

So my understanding is that the application should be processed for Servlet
3.0 specific annotations regardless of the version of the deployment

As far as I’m aware, each new Tomcat release successfully covers Servlet
3.0 CTS, so I’m wondering if I’ve missed some configuration on Tomcat side?

Any hints or ideas are highly appreciated.



P.S. The issue is easily reproducible with clean Tomcat 7.0.26 installation
and the attached simple test applications. They differ only in the
web.xml’s version and only /AnnotTest_30/AnnotServlet is correctly
responded, while /AnnotTest_25/AnnotServlet gets 404 response.

View raw message