Tuesday, August 21, 2007

Operation Aborted - dang Javascript!

There I was, innocently coding away at my Portal App in RAD 7, Portal 5.1, when suddenly my app refused to load in the browser any more.

Click "OK" on this dialog and I go straight to "The page cannot be displayed".

No error messages in the logs. Could this be a Javascript issue? Of course, I didn't get around to asking myself this question until I had uninstalled my EAR file twice, re-booted and re-created the server. *sigh*

I noticed that when the above dialog shows, IE 6.0 was also showing the exclamation mark icon in the bottom left hand corder indicating a Javascript error, but I couldn't get to see the error because it would divert to "The page cannot be displayed". So, I turned on rude Javascript notifications (I.E. 6.0): Tools > Internet Options > Advanced > Display a notification about every script error.

When I re-loaded the page, I saw a Javascript error alert first complaining about a missing semi-colon.

After that one, I got the "Operation Aborted" dialog. When I investigated I found the results of some very sloppy c&p on my behalf. The last line in the code below begins with a "+" ... syntax error.

if (theField) {
  theField.focus();
}

+ theField.name + " value: [" + theField.value

The point is that "Operation Aborted" should mean a really bad client side (Javascript) error rather than a really bad server side error.

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.

java.io.IOException: Cannot allocate memory

The machine is out of memory.. a Linux top command shows the CPUs are maxing out. Re-boot required.

java.io.IOException: Cannot allocate memory
   at java.lang.UNIXProcess.forkAndExec(Native Method)
   at java.lang.UNIXProcess.(UNIXProcess.java:157)
   at java.lang.ProcHelper.run(ProcHelper.java:60)