Hi,

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-mapping>..servletA...</servlet-mapping>
<servlet> ...servletB..</servlet>
<servlet-mapping>..servletB...</servlet-mapping>

But the mapping of a servlet can be declared before the declaration of the servlet 
element
<servlet-mapping>..servletA...</servlet-mapping>
<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("standardContext.servletMap.name", 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.


Regards,


Florent.




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to