My question is, must the filter tags always stand before the filtermapping... and those in turn be written before the servlet and servlet-mapping tags?
The reason of my question is that I get the following error messages from the servlet container (I think it is the container) when I place the filter tag after a servlet tag:
2005-jul-22 17:35:33 com.sun.enterprise.deployment.node.SaxParserHandler error ALLVARLIG: "DPL8007: Invalid Deployment Descriptors in archive \E:\sun\samples\q uickstart\hello3\ in deployment descriptor file WEB-INF/web.xml Line 45 Column 11 -- The content of element type "web-app" must match "(icon?,di splay-name?,description?,distributable?,context-param*,filter*,filter-mapping*,l istener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-li st?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,log in-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)". " CLI171 Command deploydir failed : Deploying application in domain failed; Error loading deployment descriptors for hello3 Line 45 Column 11 -- The content of e lement type "web-app" must match "(icon?,display-name?,description?,distributabl e?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,se ssion-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*)". ; requested operation cannot be completed
Joined: Apr 29, 2004
No such thing as a stupid question!
If your SCWCD book is talking about DTDs, then it is a little bit out of date. The current exam is pitched at J2EE 1.4, which uses a different method (called schemas - .xsd files) to validate XML configuration files, including the web deployment descriptor, web.xml.
The interesting thing is that for the schema for web.xml, the order of the top-level elements directly underneath <web-app> no longer matters. That said, for backward compatibility, I tend to keep things in the order that they were in in the servlet 2.3 DTD - in which case filters are declared before servlets. (Also, you do get local problems with servlet containers - Tomcat, for example, even in its latest version, will still choke if a <servlet-mapping> for a servlet comes before the corresponding <servlet> element).
I would suggest that you make sure you get to grips with servlet 2.4 deployment descriptors - how to declare them appropriately to validate against a schema. And make sure you have an up-do-date container (e.g. Tomcat 5) which supports J2EE 1.4.
Hope that helps -
David. [ July 22, 2005: Message edited by: David Bridgewater ]
Joined: Jul 06, 2005
Thanx David for your fast reply! it really helped. And I also learned that it doesnt matters in the new schemas.
Joined: Apr 29, 2004
I would really recommend getting hold of Tomcat as well. It's free, very little trouble to set up, and supports J2EE 1.4 out of the box. Small download as well (you will need J2SE 1.4 as well, though, if you haven't got that already - but you probably do).
There are several topics in the current SCWCD where you need proper J2EE 1.4 support.