Wednesday, April 25, 2007

web.xml SAXParseException in Websphere v6.1

I encountered a wierd problem while re-deploying a war file on Websphere v6.1. I started getting a SAXParseException in web.xml. The only change I had made was to introduce the "error-page" tag.

The war file was working fine in Tomcat, Weblogic and Geronimo. Digging into the logs of Websphere, I found this message:

org.xml.sax.SAXParseException: The content of element type "web-app"
must match "(icon?,display-name?,description?,distributable?,
context-param*,filter*,filter-mapping*,listener*,servlet*,
servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,
error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,
login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)". [wsjspc]


I wondered if the order of the tags was important to WAS. So I placed the error-page tag between the welcome-file-list and taglib tags..and the SAXException disappeared :)
But I found it rather strange that the order of the tags should be important..not sure if it is part of the servlet spec.