EARExpander for V4.0 expands JAR files with "all" by default
 Technote (FAQ)
 
Problem
When installing EAR files in WebSphere® Application Server V4.0 using the administrative console, EAR files are expanded into the installedApps directory as part of the installation. When the files are expanded, JAR files included in the EAR are not expanded.

However, you must use the EARExpander tool when an EAR file must be installed on a remote node. Do not specify the all option when you expand the EAR file. This is not supported in runtime by the classloader. You must use the war option.

If you do not specify war and use the default of all, activating an EJB or servlet that needs access to a JAR file or class file in the war might cause the following exception to be issued:

java.lang.reflect.InvocationTargetException: java.lang.NoClassDefFoundError: com/companyName/path1/ClassName

A module visibility mode of J2EEApplication also contributes to this since this setting prevents an EJB or servlet from accessing the JAR files in the parent war directory.
 
Cause
If the EARExpander is used to create the EnterpriseApplication.ear directory in the installedApps directory of the clone, options must be set correctly on the EARExpander command. If the -expansionflag is set to all, it expands all JAR files and creates directories, rather than leaving them as .jar files. This results in the NoClassDefFoundError.

[4/29/03 15:38:48:756 CDT] 5001da4e CompoundClass D looking for class org.apache.commons.logging.LogFactory in SinglePathClassProvider : com.ibm.ws.classloader.SinglePathClassProvider@7ccd9a4b classpath = /usr/WebSphere/AppServer/dev/installedApps/DataDict.ear/DataDictEJB.jar
CompoundClassLoader.findClass()
      SinglePathClassLoader.getClassBytes()   //  classBytes = providers[i].provider.getClassBytes(name,this);
[4/29/03 15:38:48:756 CDT] 5001da4e SinglePathCla > getClassBytes : org.apache.commons.logging.LogFactory our path points to /usr/WebSphere/AppServer/dev/installedApps/DataDict.ear/DataDictEJB.jar
[4/29/03 15:38:48:756 CDT] 5001da4e SinglePathCla D class org.apache.commons.logging.LogFactory not found
[4/29/03 15:38:48:756 CDT] 5001da4e SinglePathCla < getClassBytes
[4/29/03 15:38:48:759 CDT] 5001da4e ExceptionUtil X CNTR0019E: Non-application exception occurred while processing method getBusinessCategoryList: com.ibm.ejs.container.CreateFailureException: java.lang.reflect.InvocationTargetException; nested exception is:
java.lang.reflect.InvocationTargetException
java.lang.reflect.InvocationTargetException: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at com.ibm.datadict.ejb.DDSessionFacadeBean.ejbCreate(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ejs.container.StatelessBeanO.<init>(StatelessBeanO.java:107)



 
Solution
Use the war option to get the same results from EARExpander as from the administrative console. Note that the all option is the default if no expansion flags are used; this is unsupported in runtime.

For example:


EARExpander -ear installableApps\sampleApps.ear -expandDir installedApps\sampleApps.ear -operation expand -expansionFlags war

produces the same expansion as through the administrative console.

If you have already used the EARExpander with the -expansionFlag all, there are two solutions to fix the packaging:

  1. Expand the EAR file again with -expansionflag war.
  2. tar -cvf the ear directory from the model and tar -xvf it on the clone.
 
 
Historical Number
72792
49R
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > Deploy (for example: AAT or ANT or EAR/WAR/JAR)
Operating system(s): Windows
Software version: 4.0.7
Software edition:
Reference #: 1050387
IBM Group: Software Group
Modified date: Mar 31, 2006