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

Bug 167237

Summary: [modulecore] Problems with classpath variable dependencies
Product: [WebTools] WTP Java EE Tools Reporter: Rob Frost <rfrost>
Component: jst.j2eeAssignee: Chuck Bridgham <cbridgha>
Status: RESOLVED FIXED QA Contact: Chuck Bridgham <cbridgha>
Severity: major    
Priority: P3 CC: ccc
Version: 2.0Keywords: helpwanted
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Rob Frost CLA 2006-12-08 09:34:00 EST
Build: wtp-sdk-I-I200612070955-200612070955

Repro:

-Create a dynamic web project (did not associate with an EAR in this case)
-Open Properties->J2EE Module Dependencies->Add Variable
-Create a new cp variable pointing to some Jar on your system

What works:

-The following entry will be successfully added to the component file:

<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/var/JSR173_API">
<dependency-type>uses</dependency-type>
</dependent-module>

Intermittent problem: The first time I tried this, I hit the following problems (note: these may have been due to something unrelated to the variable entry...)

-I was unable to resolve classes in this jar successful for the project.
-On re-opening J2EE Module Dependencies, the variable entry was not listed
-An attempt to export the WAR file for the project failed with the following error:

...
org.eclipse.core.runtime.CoreException: Extended Operation failure: org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentExportOperation
	at org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard.performFinish(DataModelWizard.java:182)
	at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:695)
	at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:367)
	at org.eclipse.jface.dialogs.Dialog$3.widgetSelected(Dialog.java:638)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:925)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3463)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3077)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
	at org.eclipse.jface.window.Window.open(Window.java:796)
	at org.eclipse.ui.actions.ExportResourcesAction.run(ExportResourcesAction.java:180)
	at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:168)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:925)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3463)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3077)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1924)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1888)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:348)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:165)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:341)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:285)
	at org.eclipse.core.launcher.Main.run(Main.java:987)
	at org.eclipse.core.launcher.Main.main(Main.java:962)
org.eclipse.core.runtime.CoreException[0]: org.eclipse.core.commands.ExecutionException: Error exportingWar File
	at org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactExportOperation.execute(J2EEArtifactExportOperation.java:97)
	at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl$1.run(DataModelPausibleOperationImpl.java:376)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1742)
	at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:401)
	at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:352)
	at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.doExecute(DataModelPausibleOperationImpl.java:242)
	at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.executeImpl(DataModelPausibleOperationImpl.java:214)
	at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.cacheThreadAndContinue(DataModelPausibleOperationImpl.java:89)
	at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.execute(DataModelPausibleOperationImpl.java:202)
	at org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard$1$CatchThrowableRunnableWithProgress.run(DataModelWizard.java:211)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)
Caused by: org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException: Error opening archive for export..
	at org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentExportOperation.export(WebComponentExportOperation.java:48)
	at org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactExportOperation.execute(J2EEArtifactExportOperation.java:89)
	... 10 more
Caused by: java.lang.NullPointerException
	at org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategyImpl.getLoadedMofResources(LoadStrategyImpl.java:336)
	at org.eclipse.jst.j2ee.internal.archive.operations.ComponentLoadStrategyImpl.getLoadedMofResources(ComponentLoadStrategyImpl.java:447)
	at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ArchiveImpl.getLoadedMofResources(ArchiveImpl.java:687)
	at org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategyImpl.saveMofResources(SaveStrategyImpl.java:186)
	at org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategyImpl.save(SaveStrategyImpl.java:99)
	at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ArchiveImpl.save(ArchiveImpl.java:1083)
	at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ModuleFileImpl.save(ModuleFileImpl.java:161)
	at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ArchiveImpl.saveAsNoReopen(ArchiveImpl.java:1178)
	at org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentExportOperation.export(WebComponentExportOperation.java:44)
	... 11 more
...

After manually removing the component entry and rebuilding the project, I hit the following:

...
!ENTRY org.eclipse.wst.validation 4 0 2006-12-08 09:05:40.859
!MESSAGE 
*** ERROR ***: Fri Dec 08 09:05:40 EST 2006    org.eclipse.wst.validation.internal.core.ValidationException: CHKJ3000E: WAR Validation Failed: org.eclipse.jst.j2ee.commonarchivecore.internal.exception.DeploymentDescriptorLoadException: WEB-INF/web.xml
    	at org.eclipse.jst.j2ee.model.internal.validation.WarValidator.validateInJob(WarValidator.java:343)
    	at org.eclipse.jst.j2ee.internal.web.validation.UIWarValidator.validateInJob(UIWarValidator.java:92)
    	at org.eclipse.wst.validation.internal.operations.ValidatorJob.run(ValidatorJob.java:70)
    	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)

!ENTRY org.eclipse.wst.validation 4 0 2006-12-08 09:05:40.859
!MESSAGE 
*** ERROR ***: Fri Dec 08 09:05:40 EST 2006    org.eclipse.jst.j2ee.commonarchivecore.internal.exception.DeploymentDescriptorLoadException: WEB-INF/web.xml
    Stack trace of nested exception:
    java.lang.NullPointerException
    	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:357)
    	at org.eclipse.jem.internal.util.emf.workbench.ProjectResourceSetImpl.getResource(ProjectResourceSetImpl.java:262)
    	at org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper.getOrCreateResource(WorkbenchResourceHelper.java:384)
    	at org.eclipse.wst.common.internal.emfworkbench.integration.EditModel.getResource(EditModel.java:679)
    	at org.eclipse.wst.common.componentcore.internal.ArtifactEditModel.getResource(ArtifactEditModel.java:174)
    	at org.eclipse.wst.common.componentcore.ArtifactEdit.getResource(ArtifactEdit.java:636)
    	at org.eclipse.jst.j2ee.internal.archive.operations.ComponentLoadStrategyImpl.getMofResource(ComponentLoadStrategyImpl.java:470)
    	at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ArchiveImpl.getMofResource(ArchiveImpl.java:731)
    	at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ModuleFileImpl.getDeploymentDescriptorResource(ModuleFileImpl.java:61)
    	at org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.XmlBasedImportStrategyImpl.primLoadDeploymentDescriptor(XmlBasedImportStrategyImpl.java:39)
    	at org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.War22ImportStrategyImpl.loadDeploymentDescriptor(War22ImportStrategyImpl.java:87)
    	at org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.War22ImportStrategyImpl.importMetaData(War22ImportStrategyImpl.java:81)
    	at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.WARFileImpl.getDeploymentDescriptor(WARFileImpl.java:145)
    	at org.eclipse.jst.j2ee.model.internal.validation.WarValidator.validateInJob(WarValidator.java:328)
    	at org.eclipse.jst.j2ee.internal.web.validation.UIWarValidator.validateInJob(UIWarValidator.java:92)
    	at org.eclipse.wst.validation.internal.operations.ValidatorJob.run(ValidatorJob.java:70)
    	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
...

After restarting Eclipse and re-adding the cp variable dependency, classpath visibility and WAR export worked correctly, however, when the J2EE Module Dependencies UI was reopened the cp variable entry is listed as unselected, so the user cannot remove it.
Comment 1 Carl Anderson CLA 2013-03-07 18:18:54 EST
I am closing this as fixed- the replacement of the J2EE Module Dependencies with the Deployment Assembly addressed a lot of issues- I believe this was one of them.  If this is still an issue, please reopen this.