Tomcat 4.1.18 and servlets

I just discovered that in Tomcat 4.1.12 and upwards, the invoker servlet is disabled by default. The effect of this is that servlets which are not explicitly mapped in their webapps/WEB-INF/web.xml file will not be executed (you just get 404 not found).

To fix the problem you can either:

  • Map your servlet to a specific URL in web.xml like this:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
    <servlet>
    ...
    </servlet>
    <servlet-mapping>
    <servlet-name>transform</servlet-name>
    <url-pattern>/servlet/transform/*</url-pattern>
    </servlet-mapping>
    </web-app>


    or;

  • Turn on the invoker servlet by changing Tomcat’s conf/web.xml file and uncommenting the Built-In Servlet Mapping for the invoker servlet.

HTH