0 Replies Latest reply on May 7, 2004 6:30 AM by fburlet

    Classloading problem

    fburlet

      Hi,

      I have 3 ears that define modules A, B, C. These modules are dependent in the sense that for example, module B is using interfaces from module A to get compiled (and even deployed without having A being deployed).
      I would like to deploy/redeploy these modules at any time. So, to achieve my goal, I separated interfaces from bean in each module and put the interfaces to solve the dependency issues.

      So schematically, the 3 ears looks like:

      A :
      A.jar // only beans
      lib/A-client.jar // only interfaces from A
      META-INF - application.xml
      // defines lib/A-client.jar as java module
      // defines A.jar as ejb module

      in A.jar, the ejb-jar.xml file contains the tag <ejb-client-jar>lib/A-client.jar</ejb-client-jar> and the Class-Path from its MANIFEST.MF contains lib/A-client.jar

      B: //depends on A and C
      B.jar // an ejb module
      lib/A-client.jar // only interfaces from A
      lib/another-jar.jar // containing no beans
      lib/C-client.jar // only interfaces from C
      META-INF - application.xml

      In B.jar, the ejb-jar.xml file contains tags <ejb-client-jar> that list all the jar from the lib dir, and the Class-Path from its MANIFEST.MF contains these libs.

      C : // depends on A
      C.jar // only beans
      lib/C-client.jar // only interfaces from C
      lib/another-jar.jar // same that the one from B
      lib/A-client.jar // only interfaces from A
      META-INF - application.xml

      In C.jar, the deployment descriptor contains tags <ejb-client-jar> that list all the jars from the lib dir and the Class-Path entry from its MANIFEST.MF also contains these libs.

      All modules deploy correctly and the application runs correctly until I redeploy the modules... Once they are redeployed I got an IllegalAccessError on some beans (in fact it seems that each inner class are hitten by this error, I don't know for sure that there is a relation).
      After having a look at the documentation, it seems that the error occurs because the same classe is loaded in different class loaders. I saw that to be able to use the same classe in different ear, we have to define tag <loader-repository> in the jboss-app.xml (near the application.xml). That what I did for each module: adding

      <loader-repository>
       kiala:core=LoaderRepository
       <loader-repository-config>
       java2ParentDelegation=false
       </loader-repository-config>
      </loader-repository>
      


      The application deploys very well, but I got a ClassCastException at runtime...

      Any help would be welcome.