tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florent BENOIT <>
Subject Elements in web.xml file for 2.4 servlet specification (Tomcat 5)
Date Mon, 24 Nov 2003 10:10:55 GMT

As you already know, one of the changes of the servlet 2.4 specification 
is that it uses XML schemas.
And with this new schema, there is not anymore a strict order for the 
top level elements in the web.xml file

So we can declare a servlet and then its mapping, and then a new servlet 
with its mapping
Something like that :

<servlet> ...servletA..</servlet>
<servlet> ...servletB..</servlet>

But the mapping of a servlet can be declared before the declaration of the servlet element
<servlet> ...servletA..</servlet>

The problem is that this is a valid XML but it fails during the deployment on Tomcat 5.
This is due to the fact that during the XML parsing, when we add a servlet mapping, there
is a check to see if the servlet exists.
Method addServletMapping() in org.apache.catalina.core.StandardContext class.

// Validate the proposed mapping
        if (findChild(name) == null)
            throw new IllegalArgumentException
                (sm.getString("", name));

I agree that it is strange to do that (mapping between servlet declaration) and it can be
a minor problem but it can occurs sometimes (during some copy/paste)
So, maybe the check has to move to another place.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message