Sitestats does not load with Tomcat 7.0.35

Description

The implementation of org.apache.catalina.deploy.WebXml changed between 7.0.27 and 7.0.35:

Here is from src of tomcat 7.0.27:

public void addServletMapping(String urlPattern, String servletName) {
servletMappings.put(urlPattern, servletName);
servletMappingNames.add(servletName);
}

Here is what inside 7.0.35:

public void addServletMapping(String urlPattern, String servletName) {
String oldServletName = servletMappings.put(urlPattern, servletName);
if (oldServletName != null) {
// Duplicate mapping. As per clarification from the Servlet EG,
// deployment should fail.
throw new IllegalArgumentException(sm.getString(
"webXml.duplicateServletMapping", oldServletName,
servletName, urlPattern));
}
servletMappingNames.add(servletName);
}

...causing this error:

2013-01-18 11:30:05,184 [localhost-startStop-1] ERROR org.apache.tomcat.util.digester.Digester - End event threw exception
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tomcat.util.IntrospectionUtils.callMethodN(IntrospectionUtils.java:911)
...
Caused by: java.lang.IllegalArgumentException: The servlets named [sakai.sitestats] and [sakai.sitestats.admin] are both mapped to the url-pattern /sitestats-tool/* which is not permitted
at org.apache.catalina.deploy.WebXml.addServletMapping(WebXml.java:335)

Activity

Show:

David Adams March 28, 2013 at 6:22 PM

Thanks for working this one out. It seems cleaner to just remove that block from the web.xml instead of commenting it out. block-commented XML especially can get confusing, but in general, there should be no need to leave blocks of broken code in the current version.

Sam Ottenhoff February 20, 2013 at 11:34 AM

2.3.x merge r120323

Beth Kirschner January 30, 2013 at 8:06 AM

Thanks - works for us!

Hudson CI Server January 28, 2013 at 9:39 PM

Integrated in sitestats trunk #624 (See http://builds.sakaiproject.org:8080/job/sitestats%20trunk/624/)
remove the servlet mapping so that multiple tools can coexist. Tested ok, wicket doesnt seem to mind (Revision 118967)

Result = SUCCESS

Steve Swinsburg January 28, 2013 at 9:29 PM

Duplicate servlet-mapping blocks are not allowed, Tomcat was just being lenient before so this was always broken. I have tested this and both Wicket and Sakai seem perfectly happy without a servlet mapping, so I commented them out.

r118967

Fixed

Details

Priority

Affects versions

Fix versions

Components

Assignee

Reporter

Created January 18, 2013 at 12:22 PM
Updated January 30, 2017 at 7:24 AM
Resolved January 28, 2013 at 9:29 PM