-
Bug
-
Resolution: Obsolete
-
Major
-
JBossAS-3.2.7 Final
-
None
-
Windows XP SP2
Sun JDK 1.3.1_15
Utility JARs in EARs are not correctly added to the classpath of Web modules (and possibly EJB modules) when these utility JARs contain a META-INF\ejb-jar.xml file, and when EARs are deployed using isolated class loaders.
Consider the following situation:
Code:
test.ear
META-INF\
application.xml
web1.war
META-INF\
MANIFEST.MF
web.xml
ejb1.jar
META-INF\
ejb-jar.xml
The application.xml only defines the web module:
Code:
<application>
<display-name>TestEAR</display-name>
<module>
<web>
<web-uri>web.war</web-uri>
<context-root>/web</context-root>
</web>
</module>
</application>
Ejb1.jar is not listed as an EJB module. The web1.war MANIFEST.MF lists ejb1.jar. The web module contains a servlet that references a class in ejb1.jar. Ejb1.jar is thus used as an utility Jar.
The EAR is isolated in its own classloader space via the following configuration in conf\jboss-service.xml:
Code:
<!-- EAR deployer, remove if you are not using Web layers -->
<mbean code="org.jboss.deployment.EARDeployer" name="jboss.j2ee:service=EARDeployer">
<!-- Isolate all ears in their own classloader space -->
<attribute name="Isolated">true</attribute>
<!-- Enforce call by value to all remote interfaces -->
<attribute name="CallByValue">true</attribute>
</mbean>
When the servlet is executed, a NoClassDefFoundError occurs for the references class that is in ejb1.jar. For comparison, the above setup works on WebSphere 5.0.
Debugging and stepping through JBoss shows that the MainDeployer does not add ejb1.jar to the web module's classpath, because ejb1.jar is considered as an EJB module (ie an EJBDeployer is returned for the module). Only modules that are accepted by the JARDeployer are added to the classpath.
Adding ejb1.jar as a java module in the application deployment descriptor does not solve the problem, because the jar file is then deployed as an EJB module. Removing ejb-jar.xml from ejb1.jar does work, but that is not really an option in out project, as the Jar file is not under our control.