1 Reply Latest reply on Nov 12, 2008 9:15 AM by Carlos Angelim

    JEE 5 packaging + add jars to ejb modules

    Georg Raffer Newbie

      Hi,

      Our environment:
      JBoss 4.2.1 with > 30 EJB Modules
      Java 5

      For specific ejb modules it is required to add certain third party jars. It would be great to pack the libraries into the specific EJB module. The libraries should not be in the global ear/lib directory.

      I assumed it would work, by using the META-INF/MANIFEST.MF
      Adding the Class-Path:

      Class-Path:lib/external.jar

      So the structure of my ear file would be:

      ear
       - module_1.jar
       - lib
       - external.jar
       - META-INF
       - MANIFEST.MF (including the classpath entry)
       - module_2.jar
      

      What I found out, that this does not work. The required library (external.jar) is not available in the classpath. Does anybody know a solution for packing the application this way?

      br, Georg Raffer

      --
      http://www.im-consultants.at

        • 1. Re: JEE 5 packaging + add jars to ejb modules
          Carlos Angelim Newbie

          Hi, Georg

          You can't put a jar file inside another jar file. One solution is to reference external.jar as a shared lib inside ear's application.xml

          Your packaging layout would become:

          ear
           - module_1.jar
           - module_2.jar
           - lib
           - external.jar
          


          and your application.xml would be something like this, assuming all files 'module_X.jar' are ejb modules:
          <application xmlns="http://java.sun.com/xml/ns/j2ee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
           http://java.sun.com/xml/ns/j2ee/application_5_0.xsd"
           version="5.0">
          
           <module>
           <ejb>module_1.jar</ejb>
           </module>
          
           <module>
           <ejb>module_2.jar</ejb>
           </module>
          
           <library-directory>lib</library-directory>
          
          </application>
          
          

          Cheers,