You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by maria petrova <mi...@googlemail.com> on 2012/04/17 14:48:01 UTC
Why @WebServlet annotation is not processed when web.xml is version 2.5?
Hi,
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
descriptor.
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.
Thanks!
Maria
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.
Re: Why @WebServlet annotation is not processed when web.xml is
version 2.5?
Posted by Daniel Mikusa <dm...@vmware.com>.
----- Original Message -----
>
> As the 2 test wars were not correctly attached to my previous mail,
> I'm attaching them in a zip archive now.
You cannot attach files to the list. The list will automatically strip the attachments.
Dan
>
>
> Regards,
> Maria
>
>
> На 17 април 2012, 15:48, maria petrova < mims8010@googlemail.com >
> написа:
>
>
>
> Hi,
>
>
>
>
>
> 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 descriptor.
>
>
>
>
>
>
> 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.
>
>
>
>
> Thanks!
>
> Maria
>
>
>
>
> 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.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Why @WebServlet annotation is not processed when web.xml is
version 2.5?
Posted by maria petrova <mi...@googlemail.com>.
As the 2 test wars were not correctly attached to my previous mail, I'm
attaching them in a zip archive now.
Regards,
Maria
На 17 април 2012, 15:48, maria petrova <mi...@googlemail.com> написа:
> Hi,
>
>
> 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 descriptor.
>
>
> 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.
>
>
> Thanks!
>
> Maria
>
>
> 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.
>
Re: Why @WebServlet annotation is not processed when web.xml is version
2.5?
Posted by Pid <pi...@pidster.com>.
On 18/04/2012 09:15, maria petrova wrote:
> Hi,
>
> Thanks for the clarification. I agree that the specification is not
> absolutely clear on this matter in the given extract.
> Anyway, I simply would like to ask you, as Tomcat experts, for hints or
> ideas how to configure my Tomcat to make it pass the Servlet 3.0 CTS.
> I know that Tomcat 7.x regularly covers the complete Servlet 3.0 CTS and
> probably there is a hidden property that I’m missing?
Set 3.0 as the version in web.xml for apps using Servlet 3.0 features?
Alternatively you could, of course, set the hidden system property:
-Dorg.apache.catalina.alwaysPassServlet30CTS=true
p
> Thanks and regards,
> Maria
>
> На 17 април 2012, 22:22, Pid <pi...@pidster.com> написа:
>
>> On 17/04/2012 13:48, maria petrova wrote:
>>> Hi,
>>>
>>>
>>> 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.”/
>>
>> It also says:
>>
>> "An implementation of a particular version of the specification MUST
>> scan for all annotations supported in that configuration, unless
>> metadata-complete is specified."
>>
>> So I ask "which configuration?" - interpreting it to mean that Servlet
>> 3.0 supports the WebServlet annotation etc, and 2.5 does not, because
>> that annotation is not present in 2.5.
>>
>>
>> p
>>
>>> So my understanding is that the application should be processed for
>>> Servlet 3.0 specific annotations regardless of the version of the
>>> deployment descriptor.
>>>
>>>
>>> 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.
>>>
>>>
>>> Thanks!
>>>
>>> Maria
>>>
>>>
>>> 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.
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>> --
>>
>> [key:62590808]
>>
>>
>
--
[key:62590808]
Re: Why @WebServlet annotation is not processed when web.xml is version
2.5?
Posted by Mark Thomas <ma...@apache.org>.
On 01/06/2012 09:55, maria petrova wrote:
> Hi,
>
> As the Servlet 3.0 expert group shed some
> light<http://java.net/projects/servlet-spec/lists/users/archive/2012-05/message/1>upon
> this question I would like to raise it here again.
>
> So do you plan revising the current processing of annotations (based on the
> web.xml version) as it contradicts the clarification from the expert group
> saying:
>
> *“If you are using a Java EE 6 compatible implementation and use the
> Servlet 3.0 feature / annotation, it should work independent of the
> version of the descriptor.”*
>
> May be the default behavior should be preserved and only *org.apache.catalina.
> STRICT_SERVLET_COMPLIANCE* should be extended with an additional property
> that controls the questioned handling?
>
> What do you think?
I think that while the intent of the 3.0 EG is clear, the current EG has
identified several issues with the current approach and the discussion
on those has yet to conclude. I'd rather wait to see the final
conclusion before making any changes.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Why @WebServlet annotation is not processed when web.xml is
version 2.5?
Posted by maria petrova <mi...@googlemail.com>.
Hi,
As the Servlet 3.0 expert group shed some
light<http://java.net/projects/servlet-spec/lists/users/archive/2012-05/message/1>upon
this question I would like to raise it here again.
So do you plan revising the current processing of annotations (based on the
web.xml version) as it contradicts the clarification from the expert group
saying:
*“If you are using a Java EE 6 compatible implementation and use the
Servlet 3.0 feature / annotation, it should work independent of the
version of the descriptor.”*
May be the default behavior should be preserved and only *org.apache.catalina.
STRICT_SERVLET_COMPLIANCE* should be extended with an additional property
that controls the questioned handling?
What do you think?
Thanks and Regards,
Maria
2012/4/18 Pid <pi...@pidster.com>
> On 18/04/2012 11:27, Konstantin Kolinko wrote:
> > 18 апреля 2012 г. 12:15 пользователь maria petrova
> > <mi...@googlemail.com> написал:
> >> Hi,
> >>
> >> Thanks for the clarification. I agree that the specification is not
> >> absolutely clear on this matter in the given extract.
> >> Anyway, I simply would like to ask you, as Tomcat experts, for hints or
> >> ideas how to configure my Tomcat to make it pass the Servlet 3.0 CTS.
> >> I know that Tomcat 7.x regularly covers the complete Servlet 3.0 CTS and
> >> probably there is a hidden property that I'm missing?
> >>
> >
> > An obvious thing:
> > http://tomcat.apache.org/tomcat-7.0-doc/config/systemprops.html
> > org.apache.catalina.STRICT_SERVLET_COMPLIANCE=true
> >
> > As far as I remember, specifics of TCK cannot be discussed on a public
> list.
>
> I think mine was better [sniff]
>
>
> p
>
>
> --
>
> [key:62590808]
>
>
Re: Why @WebServlet annotation is not processed when web.xml is version
2.5?
Posted by Pid <pi...@pidster.com>.
On 18/04/2012 11:27, Konstantin Kolinko wrote:
> 18 апреля 2012 г. 12:15 пользователь maria petrova
> <mi...@googlemail.com> написал:
>> Hi,
>>
>> Thanks for the clarification. I agree that the specification is not
>> absolutely clear on this matter in the given extract.
>> Anyway, I simply would like to ask you, as Tomcat experts, for hints or
>> ideas how to configure my Tomcat to make it pass the Servlet 3.0 CTS.
>> I know that Tomcat 7.x regularly covers the complete Servlet 3.0 CTS and
>> probably there is a hidden property that I'm missing?
>>
>
> An obvious thing:
> http://tomcat.apache.org/tomcat-7.0-doc/config/systemprops.html
> org.apache.catalina.STRICT_SERVLET_COMPLIANCE=true
>
> As far as I remember, specifics of TCK cannot be discussed on a public list.
I think mine was better [sniff]
p
--
[key:62590808]
Re: Why @WebServlet annotation is not processed when web.xml is
version 2.5?
Posted by Konstantin Kolinko <kn...@gmail.com>.
18 апреля 2012 г. 12:15 пользователь maria petrova
<mi...@googlemail.com> написал:
> Hi,
>
> Thanks for the clarification. I agree that the specification is not
> absolutely clear on this matter in the given extract.
> Anyway, I simply would like to ask you, as Tomcat experts, for hints or
> ideas how to configure my Tomcat to make it pass the Servlet 3.0 CTS.
> I know that Tomcat 7.x regularly covers the complete Servlet 3.0 CTS and
> probably there is a hidden property that I'm missing?
>
An obvious thing:
http://tomcat.apache.org/tomcat-7.0-doc/config/systemprops.html
org.apache.catalina.STRICT_SERVLET_COMPLIANCE=true
As far as I remember, specifics of TCK cannot be discussed on a public list.
Best regards,
Konstantin Kolinko
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Why @WebServlet annotation is not processed when web.xml is
version 2.5?
Posted by maria petrova <mi...@googlemail.com>.
Hi,
Thanks for the clarification. I agree that the specification is not
absolutely clear on this matter in the given extract.
Anyway, I simply would like to ask you, as Tomcat experts, for hints or
ideas how to configure my Tomcat to make it pass the Servlet 3.0 CTS.
I know that Tomcat 7.x regularly covers the complete Servlet 3.0 CTS and
probably there is a hidden property that I’m missing?
Thanks and regards,
Maria
На 17 април 2012, 22:22, Pid <pi...@pidster.com> написа:
> On 17/04/2012 13:48, maria petrova wrote:
> > Hi,
> >
> >
> > 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.”/
>
> It also says:
>
> "An implementation of a particular version of the specification MUST
> scan for all annotations supported in that configuration, unless
> metadata-complete is specified."
>
> So I ask "which configuration?" - interpreting it to mean that Servlet
> 3.0 supports the WebServlet annotation etc, and 2.5 does not, because
> that annotation is not present in 2.5.
>
>
> p
>
> > So my understanding is that the application should be processed for
> > Servlet 3.0 specific annotations regardless of the version of the
> > deployment descriptor.
> >
> >
> > 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.
> >
> >
> > Thanks!
> >
> > Maria
> >
> >
> > 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.
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> --
>
> [key:62590808]
>
>
Re: Why @WebServlet annotation is not processed when web.xml is version
2.5?
Posted by Pid <pi...@pidster.com>.
On 17/04/2012 13:48, maria petrova wrote:
> Hi,
>
>
> 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.”/
It also says:
"An implementation of a particular version of the specification MUST
scan for all annotations supported in that configuration, unless
metadata-complete is specified."
So I ask "which configuration?" - interpreting it to mean that Servlet
3.0 supports the WebServlet annotation etc, and 2.5 does not, because
that annotation is not present in 2.5.
p
> So my understanding is that the application should be processed for
> Servlet 3.0 specific annotations regardless of the version of the
> deployment descriptor.
>
>
> 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.
>
>
> Thanks!
>
> Maria
>
>
> 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.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
--
[key:62590808]