0 Replies Latest reply on Aug 8, 2005 8:51 AM by Ramesh P

    Classloading quandary

    Ramesh P Newbie


      My problem is something like this

      I have one SAR mysar.sar which requires 5 other archives j1.jar, j2.jar, j3.jar. j4.jar, j5.jar. mysar.sar also requires the archives present in the server//lib folder ( the j2ee clases).

      Right now lets say, The mysar.sar package contains all the 5 jar files with approriate classpath references.

      When i deploy such a SAR , the classloading architecture of jboss is going to put all the classes ( all my jars which into the repository (cache) ), and so i dont have any classnotfound problems.

      But, i have a unique requirement in my application whereby i want a classloader which is capable of loading all the classes except the classes in j4.jar and j5.jar.
      The classloaders i ahve with me are the NoAnnotation Classloader which has all the UCLs created, the AppClassloader ( Server loader with default classes) and the Launcher.

      Iam perfectly ok with moving around my archives to any locaation either inside my SAR or outside ( in server//lib folder, or anywhere).

      But having understood the classloading architecture of Jboss iam finding the above proposition very difficult.

      This is what i have tried but to no avail

      1. I scoped out the classes in my SAR mysar.sar to create a HeirarchichalLoaderRepository3. But this only makes sure that my classes are used first and does not solve my problem

      2. I tried to load j1, j2 and j3 using the -L command line options to make the Server loader load these classes , ok now i ahve 2 class loaders , the UCL which loaded the j4, j5 and the apploader which loads j1, j2 and j3.

      But unfortunately this does not work cause the Server loader does not have access to the server//lib classes, which are required.

      The one way i think i can get around this would be to make the Server loader also load the server//lib archives, ( by spelling it out one-by-one). But Iam not sure if it will spell problems somewhere else.

      But before going about that i wanted to know if there was any other cleaner approach to achieve what i described.

      Any help is greately appreciated.