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

Bug 324760

Summary: EAR validation error if web-uri is changed
Product: [WebTools] WTP Java EE Tools Reporter: Wojciech Galanciak <wojciech.galanciak>
Component: jst.j2eeAssignee: Carl Anderson <ccc>
Status: NEW --- QA Contact: Chuck Bridgham <cbridgha>
Severity: normal    
Priority: P3 CC: ccc, krzysztof.daniel
Version: 3.0.4   
Target Milestone: Future   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Wojciech Galanciak CLA 2010-09-08 11:43:44 EDT
It is reproduce on JEE Eclipse 3.6 build 20100617-1415.

Steps to Reproduce:
1. Create the EAR project (Aaa).                              
2. Create the Dynamic Web project (Bbb).                      
3. Right click the Aaa > property > J2ee module dependency.   
4. Set dependency to Bbb.                                     
5. Open the application.xml in Aaa.                           
6. Change the <web-url> from Bbb.war to Ccc.war               
7. Save application.xml.

In result there is an error:
The deployment descriptor of the module 'Ccc.war' cannot be loaded or found.

This problem does not occur in Eclipse 3.2.2.

Changes which caused it is between 1.8 and 1.9 versions of org.eclipse.jst.j2ee.componentcore.util.EARVirtualComponent. There is probably mistake in comments cause a comment for 1.9 is "[188737] JEE Preference consolidation" which is not related to real changes between both versions.
Comment 1 Carl Anderson CLA 2010-09-08 22:46:26 EDT
Wojciech, your steps to reproduce confuse me.  First, you state that you reproduced this on Eclipse 3.6 (which corresponds to WTP 3.2), but in step 3, you state "J2ee module dependency".  That page was replaced with the Deployment Assembly page in WTP 3.2.

And, speaking of which, that is the correct place for you to make this change- if you bring up the Deployment Assembly page on the EAR and modify the Deploy Path from Bbb.war to Ccc.war, then both the application.xml's <web-uri> entry and the .settings/org.eclipse.wst.common.component file's mapping of Bbb to the archiveName of Ccc.war will be properly updated.

The problem with simply updating the application.xml is that the deployment information for project Bbb is kept in the component file, which has an entry of:

<dependent-module archiveName="Bbb.war" deploy-path="/" handle="module:/resource/Bbb/Bbb">

That entry tells our code at deploy time to package the Bbb project into Bbb.war, and the application.xml has a reference to Bbb.war.  But, when only the application.xml is updated to Ccc.war, our code will package the Bbb project into Bbb.war, which does not have an entry in the application.xml.  Therefore, the validation error is correct.
Comment 2 Wojciech Galanciak CLA 2010-09-09 05:31:26 EDT
Yes, you are right that there is a mistake in reproduction steps cause they are for 3.4.2. In 3.6 it is possible to edit deploy path on Deployment
Assembly page. In this case I changed version to 3.0.4.

I think that an easy workaround for this problem in 3.4.2 is to edit/add archiveName attribute in .settings/org.eclipse.wst.common.component. Unfortunately, it is not a clear for a user to do that cause this file is not a part of jee specification.

In 3.2.2 afer step 6 there is no error message and an Aaa EAR can be exported correctly. There is also no such attribute as archiveName in its org.eclipse.wst.common.component.