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


      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:


      So the structure of my ear file would be:

       - 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


        • 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:

           - 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"