We have an webapp that has been running fine on Tomcat 7.0.99, but failed to
load properly on Tomcat 7.0.100, upon investigation, it looks like
javax.servlet.ServletContainerInitializer that we defined in jar is not being
loaded, and to make sure, we created a blank new webapp with a blank
implementation of ServletContainerInitializer
public class TestSCI implements ServletContainerInitializer{
@Override
public void onStartup(Set<Class<?>> arg0, ServletContext arg1)
throws ServletException {
System.out.println("********************************");
}
}
And add this class and also the
“META-INF/services/javax.servlet.ServletContainerInitializer” entry in a jar
and place this jar in WEB-INF/lib folder, with this simple setup, test shows
that the ServletContainerInitializer is being loaded on Tomcat 7.0.99, but is
not being loaded on Tomcat 7.0.100, is this change intentional on Tomcat
7.0.100 or is this a bug?
Looking at org.apache.catalina.startup.WebappServiceLoader from source code of
Tomcat 7.0.100, it seems that the leading slash added on line 111 may have
caused the issue, but I am not entirely sure.
On Tomat 7.0.100, ServletContainerInitializer will load if it is placed as
plain text file entry in WEB-INF/classes, but the same
ServletContainerInitializer will NOT load when the
“META-INF/services/javax.servlet.ServletContainerInitializer” entry is placed
in a jar file, Tomcat 7.0.99 will load the ServletContainerInitializer
regardless where the
“META-INF/services/javax.servlet.ServletContainerInitializer” entry is placed.
Has anyone encountered this issue on Tomcat 7.0.100 and if this behavior change
is intentional?
Thanks.