Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Servlet 3.0 with annotations & tomcat 7

870999Jun 23 2011 — edited Jun 24 2011
Hey Folks,
I am at my wits end here trying to deploy a servlet with annotations.
I have managed to successfully deploy it without annotations i.e via the web.xml & everything is fine but I get a status 404 when trying to deploy with annotations.

I am running tomcat :
Server version: Apache Tomcat/7.0.12
Server built: Apr 1 2011 06:13:02
Server number: 7.0.12.0
OS Name: Linux
OS Version: 2.6.35-28-generic
Architecture: i386
JVM Version: 1.6.0_20-b02
JVM Vendor: Sun Microsystems Inc.

I followed the spec so I am sure I am doing everything right from a coding point of view, there is no mention of this servlet what so ever in the apps web.xml

WebServlet(urlPatterns={"/HelloServlet3"})
+public class HelloServlet3 extends HttpServlet {+
+@Override+
public void doGet(HttpServletRequest request,
HttpServletResponse response)
+...+
+}+


The compiled class file (wihin package moreservlets) is located in the following directory
*~/tomcat/apache-tomcat-7.0.12/webapps/onjava/WEB-INF/classes/moreservlets*


The application onjava is mapped in the server.xml
view plaincopy to clipboardprint?
+<Context path="/onjava" docBase="/home/rob/tomcat/apache-tomcat-7.0.12/webapps/onjava" debug="0" reloadable="true" />+


This application has both annotated servlets which don't work & regular servlets with web.xml which do work, can I mix both for onjava above?


Any help greatly appreciated
Thanks
Rob
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 22 2011
Added on Jun 23 2011
3 comments
704 views