4 Replies Latest reply on May 8, 2008 2:02 AM by gitu

    Classloading with jboss_app.xml

    gitu

      Hi,

      Am using Jboss5.0 Beta4 . I have two EJB's -e1 and e2 deployed and trying to lookup from one to another. e2 interafce is in \server\all\lib directory. and e1 is doing lookup to e2.

      Am also using jboss_app.xml so that jboss will first loads jars from my EAR e1 instead of server\all\lib. It does gets jars from my ear instead of server lib.

      <jboss-app>
       <loader-repository>
       com.avaya:archive=Scheduler.ear
       </loader-repository>
      </jboss-app>
      
      


      Lookup is also sucessful. but I need to do another validation if e2 has implemented one of my interface com.my.job Interface. com.my.job is present in server\all\lib. Am using below logic to check this .

      job.class.isAssignableFrom(e2)
      should return true.

      Now this works fine on WAS6.1.It works fine with jboss5.0 also IF e2 interface (not its implementation class ) is part of e1 ear i.e bundled together

      But when I move this interface out of ear and put it in server\all\lib , lookup is sucessful but isAssugableFrom fails !

      This looks like wrong algorithm of isAssignableFrom.

      Hope this isnt confusing .. Can anyone help me with this.

        • 1. Re: Classloading with jboss_app.xml
          gitu

          Looks like its classloders issue.

          com.my.job interface is loaded by one classloader and e2 by another.

          What could be solution for this ??

          • 2. Re: Classloading with jboss_app.xml
            jaikiran

             

            "Gitu" wrote:


            But when I move this interface out of ear and put it in server\all\lib , lookup is sucessful but isAssugableFrom fails !



            Why do you want to move your interface to the server\all\lib?

            Also, read through these classloader related documents:

            http://wiki.jboss.org/wiki/JBossClassLoadingUseCases

            http://wiki.jboss.org/wiki/ClassLoadingConfiguration

            • 3. Re: Classloading with jboss_app.xml
              gitu

              I want to move this interface out of ear as this Interface is actually stub of e2 and will be provided by other module. I am aware of its JNDI details so that I can perform a lookup. It cant be bundled along with my ear.

              e2 module owner will place it in server\all\lib directory.

              Since lookup is sucessful , its able to find e2 , but as these are loaded by different classloader , isAssignableFrom (algorithm) is failing.

              • 4. Re: Classloading with jboss_app.xml
                gitu

                Have solved the problem.

                Actually job.class was out in server\all\lib and also in e1 EAR.
                So when I was checking for isAssignableFrom , the class versions were different as classloaders were different and isolation ear was enabled using jboss_app.xml.

                I removed job.class from e1 ear and now have just one copy in lib and no other module will have it.

                isAssignableFrom is returning correct value.