1 Reply Latest reply on Sep 25, 2008 9:50 AM by Marco Zanker

    classloader problem with a ear + sar inside

    Marco Zanker Newbie

      Hi jboss specialists.

      I try to deploy an ear containg 1 sar 1 ejb and multible shared jars.
      I try the follwing structure of the ear:

      app.ear
      |
      |--- META-INF
      | |
      | |--- application.xml
      | |--- jboss-app.xml
      |
      |--- lib
      | |
      | |--- lib1.jar
      | |--- lib2.jar
      | |--- .....
      |
      |--- service.sar
      |--- ejb.jar

      The service.sar also contains some jar-files which only should by loaded by the sar-classes. So the sar-file and it's packages should be loaded in seperate classloader.
      For that reason, the sar file also contains a jboss-app.xml with the following entry:
      <loader-repository>com.test.app:loader=service.sar</loader-repository>

      If I deploy the sar-file standalone to jboss, this works fantastic. I see in the jmx-console that a new loader-repository is created.
      But if I try to pack the sar in ear, no loader-repository is created for the sar-file!!!
      So why is this entry in this way ignored?

      The loader-repository entry in the jboss-app.xml of the ear does not help, because both ejb and sar should run in a different repositorys. the ejb-.jar must run in
      the ucl because it uses some libraries of the common jboss lib-path.
      You are asking why everything is packed together in the same ear-file? Both (sar and ear) share libraries (in a special version) in a in the lib path, and they should only deployed once...

      Thanks for help

        • 1. Re: classloader problem with a ear + sar inside
          Marco Zanker Newbie

          ok, we found this wiki in which it is described, but not why it works in this way...
          http://wiki.jboss.org/wiki/ClassLoadingConfiguration

          "There are two levels of scoping, isolation from other deployments, and isolation that overrides the loading of JBoss server classes. With nested modules, only the top level file may specify class loader scoping. If you have a .ear file containing other modules, only scoping specified in the .ear's META-INF/jboss-app.xml is used. This also applies for any other deployment which contains sub-deployments. For example, if a .sar contains a .war deployment, only the .sar META-INF/jboss-service.xml scoping has effect."

          Btw I'm looking for another solution, f.e. in different packages.