1 Reply Latest reply on Mar 4, 2005 11:34 AM by Tushar Patel

    ejb jar as utility jar

    Erik Post Newbie

      I'm running into an issues relating to manifest classpaths and ejb jar files in JBoss 3.2.7 on Windows XP with Sun JDK 1.3.1_15.

      Consider the following situation:

      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:
      <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:
       <!-- 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. 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.

      Is there a solution for this problem, or is this a bug in JBoss?

        • 1. Re: ejb jar as utility jar
          Tushar Patel Newbie

          This is what the ouput is when DEBUG is on

          09:32:56,103 DEBUG [Member#findByLastName] Executing SQL: SELECT FROM members t0_o WHERE (t0_o.last_name = ?)
          09:32:56,103 DEBUG [Member#findByLastName] Executing SQL: SELECT FROM members t0_o WHERE (t0_o.last_name = ?)