| Author |
Why is web.xml not prior to annotation in conflict?
|
Leon Omk
Ranch Hand
Joined: Aug 17, 2010
Posts: 72
|
|
Running in Tomcat 7.x, I type http://localhost/MyApp/ServletOne, then ServletOne is invoked. Why not ServletTwo?
i. Configuration specified in the main web.xml or a web fragment takes
precedence over the configuration specified via annotations.
In the servlet3.0 spec page 103, doesn't it mean web.xml is prior to annotation when there is conflict? Is it a bug for Tomcat?
|
OK, so that other guy knows Java better than I do, but I bet he can't speak Wuhanese(a Chinese Dialect) like me.
|
 |
abani patra
Ranch Hand
Joined: Oct 11, 2011
Posts: 70
|
|
Hi,
I do not have much idea still I think the ServletTwo url pattern is overriding the pattern so it is being called.
|
 |
Leon Omk
Ranch Hand
Joined: Aug 17, 2010
Posts: 72
|
|
This is the annotation for servletTwo.
|
 |
Kumaravadivel Subramani
Ranch Hand
Joined: Jul 05, 2008
Posts: 162
|
|
Hi,
Can you please provide your full view of web.xml file? Since no url-pattern is defined for ServletTwo, web container can't initiate/process this. Also you can provide us the log file to proceed further.
|
No pain, No gain.
OCJP 1.6
|
 |
Hebert Coelho
Ranch Hand
Joined: Jul 14, 2010
Posts: 754
|
|
Is your class in the default package?
|
[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
|
 |
Leon Omk
Ranch Hand
Joined: Aug 17, 2010
Posts: 72
|
|
Hebert Coelho wrote:Is your class in the default package?
Yes, all servlets are in default package.
|
 |
Vijitha Kumara
Bartender
Joined: Mar 24, 2008
Posts: 3670
|
|
Yes, all servlets are in default package.
don't do that, you'll run in to trouble if you do so. Use packages and see still the issue exists...
|
SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
|
 |
 |
|
|
subject: Why is web.xml not prior to annotation in conflict?
|
|
|