Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333259 - Initial attribute "xmlns:web" in Java EE 6 web.xml is invalid
Summary: Initial attribute "xmlns:web" in Java EE 6 web.xml is invalid
Status: CLOSED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows 7
: P2 normal with 2 votes (vote)
Target Milestone: Future   Edit
Assignee: Carl Anderson CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard:
Keywords:
: 343324 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-12-28 04:02 EST by Wolfgang Knauf CLA
Modified: 2014-01-26 13:37 EST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Knauf CLA 2010-12-28 04:02:56 EST
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
Comment 1 Wolfgang Knauf CLA 2011-01-27 06:16:52 EST
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.
Comment 2 Carl Anderson CLA 2011-04-20 11:38:29 EDT
*** Bug 343324 has been marked as a duplicate of this bug. ***
Comment 3 Richard A. Sitze CLA 2011-07-16 19:12:15 EDT
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.
Comment 4 Roberto Sanchez Herrera CLA 2014-01-21 13:15:03 EST
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.
Comment 5 Wolfgang Knauf CLA 2014-01-26 13:37:39 EST
Closing...