Skip to content

Conversation

jsimone
Copy link

@jsimone jsimone commented Dec 21, 2011

The embedded Tomcat container initialization won't read Servlet 3.0 annotations from anywhere except jars in the classpath or WEB-INF/classes. This is fine for appassembler scripts because the jar of the app itself goes on the classpath. However it's an issue when launching from Eclipse. The Servlet in the demo doesn't work.

Another way around this would be to drop the web.xml and use programmatic servlet registration:

    Tomcat.addServlet(ctx, "MyServlet", "servlet.HelloServlet");
    ctx.addServletMapping("/hello", "MyServlet");

The Servlet 3.0 annotations would still have to be removed.

Will make updates to the article after I get any feedback on this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants