• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

WebServlet annotation not working in Tomcat 7.0?

 
Ram Narayan.M
Ranch Hand
Posts: 247
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65122
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to ask Tomcat questions in the Tomcat forum. I have moved this post there for you.
 
Ram Narayan.M
Ranch Hand
Posts: 247
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic