aspose file tools*
The moose likes Tomcat and the fly likes WebServlet annotation not working in Tomcat 7.0? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "WebServlet annotation not working in Tomcat 7.0?" Watch "WebServlet annotation not working in Tomcat 7.0?" New topic
Author

WebServlet annotation not working in Tomcat 7.0?

Ram Narayan.M
Ranch Hand

Joined: Jul 11, 2010
Posts: 247

Hi all,

Tomcat version: 7.0.19

I tried my first Servlet program with WebServlet annotation...



When i hit the page, it ends up in "404- resource is not available" ... Please guide me if i have missed anything...


SCJP 6 [SCJP - Old is Gold]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61654
    
  67

Please be sure to ask Tomcat questions in the Tomcat forum. I have moved this post there for you.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ram Narayan.M
Ranch Hand

Joined: Jul 11, 2010
Posts: 247

Thanks Bear...

Just now got to solve the issue...In "web-app" tag in "web.xml" of the web application, I have specified "metadata-complete" to "true" which blocked the container not to look for Annotated Servlet classes... It should be either false (or) should be left...

Those who face this same issue... the below quote from documentation will be useful...



The metadata-complete attribute defines whether this
deployment descriptor and other related deployment
descriptors for this module (e.g., web service
descriptors) are complete, or whether the class
files available to this module and packaged with
this application should be examined for annotations
that specify deployment information.

If metadata-complete is set to "true", the deployment
tool must ignore any annotations that specify deployment
information, which might be present in the class files
of the application.

If metadata-complete is not specified or is set to
"false", the deployment tool must examine the class
files of the application for annotations, as
specified by the specifications.
 
 
subject: WebServlet annotation not working in Tomcat 7.0?