Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 405873

Summary: "Generate Deployment Descriptor Stub" generates incorrect web.xml for web 3.1
Product: [WebTools] WTP Java EE Tools Reporter: Fred Bricon <fbricon>
Component: jst.j2eeAssignee: Carl Anderson <ccc>
Status: RESOLVED FIXED QA Contact: Chuck Bridgham <cbridgha>
Severity: blocker    
Priority: P3 CC: alkazako, ccc, dgolovin, manderse, mistria, raghunathan.srinivasan, raj.alagumalai, shr31223, stryker
Version: 3.5   
Target Milestone: 3.5 M7   
Hardware: PC   
OS: Windows 7   
Whiteboard: JavaEE7
Bug Depends on: 400486    
Bug Blocks:    
Attachments:
Description Flags
Update the Java EE model providers
none
Update the EJB model provider
none
Update the Java EE model providers none

Description Fred Bricon CLA 2013-04-17 08:15:24 EDT
Tested with Eclipse Java EE Kepler M6

* Create a new Dynamic Web Project
* select Dynamic web module version 3.1
* click finish
* assert no web.xml was created under WebContent/WEB-INF
* right click on gen'd project and "Java EE Tools" > "Generate Deployment Descriptor Stub"
* the generated web.xml contains : 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">

it mixes 3.1 and 3.0


If you generate the web.xml during project creation, it contains :
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">

which seems more legit
Comment 1 Chuck Bridgham CLA 2013-04-17 09:31:39 EDT
Carl - can you take a look?
Comment 2 Fred Bricon CLA 2013-04-17 10:44:31 EDT
BTW I can't see any 3.1 icon in the project explorer view (whether web.xml exists  or not). Is this a bug (all versions < 3.1 have it) or a feature (icons are sooo 2012)?
Comment 3 Denis Golovin CLA 2013-04-17 17:39:25 EDT
Actually whatever version is selected from Dynamic web module version combo web-app node always generated with 

xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"

they added after WebFacetInstallDelegate.populateDefaultContent() is called in 

createWeb31DeploymentDescriptor
createWeb30DeploymentDescriptor
createWeb25DeploymentDescriptor
Comment 4 Max Rydahl Andersen CLA 2013-04-18 06:35:37 EDT
I would consider this a blocker since this will fail more than a few servers and plugins out there that expect WTP to create files based on what facet version is chosen.
Comment 5 Carl Anderson CLA 2013-04-22 17:10:58 EDT
(In reply to comment #2)
> BTW I can't see any 3.1 icon in the project explorer view (whether web.xml
> exists  or not). Is this a bug (all versions < 3.1 have it) or a feature
> (icons are sooo 2012)?

It is bug 400489 .  None of the Java EE 7 projects have their new icons yet.
Comment 6 Carl Anderson CLA 2013-05-01 11:52:49 EDT
The main problem here is that bug 400486 was incomplete.  The populateRoot() method of the various model providers was not updated to handle Java EE 7.
Comment 7 Carl Anderson CLA 2013-05-01 11:54:41 EDT
Created attachment 230350 [details]
Update the Java EE model providers

The default for an unknown version is the Java EE 7 ones.
Comment 8 Carl Anderson CLA 2013-05-01 11:55:12 EDT
Created attachment 230351 [details]
Update the EJB model provider
Comment 9 Carl Anderson CLA 2013-05-01 16:13:25 EDT
Created attachment 230362 [details]
Update the Java EE model providers
Comment 11 Raj Alagumalai CLA 2013-05-17 19:48:24 EDT
could someone please confirm if this fix made it into the M7 build at http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/keplerm7
Comment 12 Raj Alagumalai CLA 2013-05-21 01:44:56 EDT
I am able to reproduce this issue on the Java EE M7 build available at http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/keplerm7

Version: Kepler Release
Build id: 20130509-1105

steps to repro


create a new dynamic web project
pick 2.5 for jst.web facet
click finish


facet.core.xml contents

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <fixed facet="wst.jsdt.web"/>
  <fixed facet="java"/>
  <fixed facet="jst.web"/>
  <installed facet="java" version="1.5"/>
  <installed facet="jst.web" version="2.5"/>
  <installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>


web.xml contents

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.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">
  <display-name>web_25</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>
Comment 13 Alexey Kazakov CLA 2013-05-24 19:33:13 EDT
>> I am able to reproduce this issue on the Java EE M7 build

I can confirm that this bug still presents in M7.
This is a blocker since web.xml is generated broken for any dynamic web facet which version less then 3.1

It still has xmlns:web="http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" whatever facet version you selected.
Comment 14 Fred Bricon CLA 2013-05-25 04:27:52 EDT
The bug is still present in the JavaEE RC1 (30130523-2011) distro :

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
Comment 15 Rob Stryker CLA 2013-05-28 10:13:46 EDT
I have a stack trace for when the file gets updated to the incorrect data. 

Web25ModelProvider(JEE5ModelProvider).modify(Runnable, IPath) line: 261	
Web25MergedModelProvider.modify(Runnable, IPath) line: 92	
WebFacetInstallDelegate.populateDefaultContent(IProject, IProjectFacetVersion) line: 311	
WebFacetInstallDelegate.createWeb25DeploymentDescriptor(IProject, IProjectFacetVersion, IFolder, IProgressMonitor) line: 274	
WebFacetInstallDelegate.execute(IProject, IProjectFacetVersion, Object, IProgressMonitor) line: 128	
FacetedProject.callDelegate(IProjectFacetVersion, IDelegate, Object, Object, IProgressMonitor) line: 1477	
FacetedProject.modifyInternal(Set<Action>, IProgressMonitor) line: 441	
FacetedProject.mergeChangesInternal(IFacetedProjectWorkingCopy, IProgressMonitor) line: 1181	
FacetedProject.access$2(FacetedProject, IFacetedProjectWorkingCopy, IProgressMonitor) line: 1117	
FacetedProject$5.run(IProgressMonitor) line: 1099	
Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 2345	
FacetedProject.mergeChanges(IFacetedProjectWorkingCopy, IProgressMonitor) line: 1109	
FacetedProjectWorkingCopy.commitChanges(IProgressMonitor) line: 2020	
WebProjectWizard(ModifyFacetedProjectWizard).performFinish(IProgressMonitor) line: 400	
WebProjectWizard(NewProjectDataModelFacetWizard).performFinish(IProgressMonitor) line: 282	
ModifyFacetedProjectWizard$3.run(IProgressMonitor) line: 331	
Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 2345	
ModifyFacetedProjectWizard$4.run(IProgressMonitor) line: 345	
ModalContext$ModalContextThread.run() line: 121	



Before the update, web.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

After this call, web.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.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">
  <display-name>D328</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>


I set breakpoints at all code that Roberto added in his commit, and none were hit. My workflow was a simple new Dynamic Web Project with 2.5 facet.  It would appear something has been missed.
Comment 16 Raj Alagumalai CLA 2013-06-06 03:41:08 EDT
verified that the issue has been addressed in RC3

Eclipse Platform

Version: 4.3.0
Build id: I20130530-1430


<?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" 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">
  <display-name>dwp25</display-name>
</web-app>


<?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" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
  <display-name>web30</display-name>
</web-app>

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>web31</display-name>
</web-app>
Comment 17 Carl Anderson CLA 2013-06-06 14:05:18 EDT
I am going to close this down again as resolved.  The fix here did fix the original issue as it stood, but further fixes have fixed the other code path as well.