Friday, August 17, 2007

com.ibm.etools.archive.exception.NoModuleFileException: A file does not exist for module element having uri:

Portal App in RAD 7.

I created an IBM Portlet with Struts portlet application for Portal 5.1. I used the wizard to give me a sample portlet.

Off the bat it worked. But it used WebContent, rather than web.

I then went into org.eclipse.wst.common.component and made two changes to give me:

<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="myApp">
        <wb-resource deploy-path="/" source-path="/web"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
        <property name="java-output-path" value="web/WEB-INF/classes"/>
        <property name="context-root" value="/myApp"/>
    </wb-module>
</project-modules>

I also went into Project Properties > Java Build Path > Source and changed default output folder to "myApp/web/WEB-INF/classes". Then, in Package Explorer I refactored WebContent and renamed it "web". I re-built the application and it correctly populated the "web/WEB-INF/classes" directory with the compile java classes.

Then I attempted to run the app and found this in my logs:

[17/08/07 12:09:42:626 EST] 6aa0f8d4 ApplicationMg E WSVR0100W: An error occurred initializing, myAppEAR
com.ibm.etools.archive.exception.NoModuleFileException: A file does not exist for module element having uri: eJobSucks.war
 at com.ibm.etools.commonarchive.impl.ModuleRefImpl.checkType(ModuleRefImpl.java:715)
 at com.ibm.etools.commonarchive.impl.ModuleRefImpl.initModuleFileFromEAR(ModuleRefImpl.java:270)
 at com.ibm.etools.commonarchive.impl.ModuleRefImpl.getModuleFile(ModuleRefImpl.java(Compiled Code))
 at com.ibm.ws.runtime.component.DeployedModuleImpl.isOpen(DeployedModuleImpl.java:111)
 at com.ibm.ws.runtime.component.DeployedModuleImpl.close(DeployedModuleImpl.java:152)
 at com.ibm.ws.runtime.component.DeployedModuleImpl.initialize(DeployedModuleImpl.java:293)
 at com.ibm.ws.runtime.component.DeployedApplicationImpl.initializeModule(DeployedApplicationImpl.java:765)
 at com.ibm.ws.runtime.component.DeployedApplicationImpl.initialize(DeployedApplicationImpl.java:427)
 at com.ibm.ws.runtime.component.ApplicationMgrImpl.initializeApplication(ApplicationMgrImpl.java(Compiled Code))
 at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:559)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
 at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
 at com.tivoli.jmx.modelmbean.MMBInvoker.invoke(MMBInvoker.java:46)
 at com.tivoli.jmx.modelmbean.MMBInvoker.invokeOperation(MMBInvoker.java:115)
 at com.tivoli.jmx.modelmbean.DynamicModelMBeanSupport.invoke(DynamicModelMBeanSupport.java:409)
 at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:323)
 at com.tivoli.jmx.GenericMBeanSupport.invoke(GenericMBeanSupport.java:178)
 at com.tivoli.jmx.MBeanAccess.invoke(MBeanAccess.java:113)
 at com.tivoli.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:290)
 at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:659)
 at com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:130)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
 at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
 at com.ibm.ws.management.connector.soap.SOAPConnector.invoke(SOAPConnector.java:320)
 at com.ibm.ws.management.connector.soap.SOAPConnector.service(SOAPConnector.java:192)
 at com.ibm.ws.management.connector.soap.SOAPConnection.handleRequest(SOAPConnection.java:55)
 at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:624)
 at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:448)
 at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:912)

In the application.xml of my EAR file, this was the context root:

<context-root>.myApp</context-root>

Went to Project Properties > Web Project Settings. Changed ".myApp" to "/myApp". Go back into application.xml, Module tab. Click on the module for myApp, press "Refresh" on the context root.

At the same time I couldn't open web.xml or portlet.xml - web.xml would go back to an xml editor and portlet.xml simply wouldn't open. The project wasn't considered to be a portlet application anymore. I restarted RAD 7 and then I could open both files in their visual editors once more.

The app started up ok after that.

No comments: