Community
Participate
Working Groups
Build Identifier: Eclipse M20100909-0800, wtp-R-3.2.2-20100915173744 I think there is a bug in the way Eclipse creates a web.xml. I am not sure about this and asked this in the forums before, but did not receive a reply (no direct link available, because the forums web page does not show anything today): A default "web.xml" (here for a JavaEE6 web project) contains an attribute "xmlns:web=...": <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> ... </web-app> The sense of the "xmlns:web" attribut should be that you can build this kind of web.xml: <?xml version="1.0" encoding="ASCII"?> <web:web-app xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" ...> <web:display-name>TestWeb</web:display-name> .... </web:web-app> But this will result in validation errors if the autogenerated web.xml is used. I think the "xmlns:web" attribute should be: <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> Is this right? Or do I misunderstand something ;-)? By the way: this must be quite an old one... Reproducible: Always
The problem is also valid for a 2.5 webapp. This is the web.xml snippet: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> As you can see, the "xmlns:web" attribute here is also wrong, it should be "http://java.sun.com/xml/ns/javaee" in my opinion. For 2.4 web.xml, this is OK because no "xmlns:web" is generated.
*** Bug 343324 has been marked as a duplicate of this bug. ***
It's 1.5 years since this was reported, and it's now in Indigo. I'll add that the same problem occurs with a generated EAR files application.xml: <?xml version="1.0" encoding="UTF-8"?> <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" id="Application_ID" version="6"> ... </application> xmlns:application and the schemaLocation don't match.
This problem is fixed indirectly in WTP 3.5.2 and 3.6, because in those versions of WTP, the web prefix is not added to the deployment descriptor. And the same for the EAR deployment descriptor. Resolving as fixed, base on the explanation above.
Closing...