I have a web project that has a \META-INF\services\javax.servlet.ServletContainerInitializer file with its content pointing to the fully qualified name of a class that implements the ServletContainerInitializer interface. I basically followed the example given here: http://nullhaus.com/2011/03/using-servlets-3-0-servletcontainerinitializer/
I put debug lines in my class that implements the ServletContainerInitializer interface and it never makes it there. Not even the default constructor…
My application folder structure is as follows:
\MyApp
\META-INF\services\javax.servlet.ServletContainerInitializer
\WEB-INF\classes\
... [list of classes and packages go here]
Any ideas what I need to check for??
Note 1: My Tomcat publishes from an exploded external folder that contains my application
Note 2: I started my Tomcat from Eclipse – if that makes a difference!
Well, I think that you’ll need to wrap your initializer class (and it’s services-related META-INF directory) into a separate *.jar and put it in the
WEB-INF/lib.This is a JAR service, so I guess it could have something to do with problems with discovering services in a *.war file. Moreover, it doesn’t even help if you put your META-INF directory inside
WEB-INF/classesand setunpackWAR=falsein your Tomcat’sserver.xml.HTH.