1 Reply Latest reply on Feb 24, 2003 11:36 PM by adrian.brock

    reflection w/ jboss-3.0.6

    sblanc

      hello !
      I'm trying to know if there was a significant change between jboss-3.0.4 and jboss-3.0.6 related to the classloading when using reflection. I was using java reflection the following w/ jboss-3.0.4 in a session bean:
      Class homeClass = null;
      try
      {
      homeClass = Class.forName(homeClassName);
      }
      catch (ClassNotFoundException e)
      {
      ...
      which was working fine, the class being in my jar manifest and declared as an ejb-external-ref.
      I recently ported my code to jboss-3.0.6 and this piece of code is not working anymore; when I print the session bean classloader I pretty much get the same as the system class loader where as before I got the relevant applicative jars too:

      2003-02-24 14:55:50,190 INFO [STDOUT] level 0
      2003-02-24 14:55:50,190 INFO [STDOUT] CL=org.jboss.mx.loading.UnifiedClassLoader3@1e5c339{ url=file:/C:/Data/JBOSS-3.0.6/server/ems/tmp/deploy/server/ems/deploy/gem.ear/38.gem.ear ,addedOrder=38}
      2003-02-24 14:55:50,210 INFO [STDOUT] level 1
      2003-02-24 14:55:50,210 INFO [STDOUT] CL=org.jboss.system.server.NoAnnotationURLClassLoader@6e1408
      2003-02-24 14:55:50,210 INFO [STDOUT] level 2
      2003-02-24 14:55:50,210 INFO [STDOUT] CL=sun.misc.Launcher$AppClassLoader@12f6684
      2003-02-24 14:55:50,210 INFO [STDOUT] file:/C:/Data/j2sdk1.4.1_01/lib/tools.jar
      2003-02-24 14:55:50,210 INFO [STDOUT] file:/C:/Data/JBOSS-3.0.6/bin/run.jar
      2003-02-24 14:55:50,230 INFO [STDOUT] level 3
      2003-02-24 14:55:50,230 INFO [STDOUT] CL=sun.misc.Launcher$ExtClassLoader@f38798
      2003-02-24 14:55:50,230 INFO [STDOUT] file:/C:/Data/j2sdk1.4.1_01/jre/lib/ext/dnsns.jar
      2003-02-24 14:55:50,230 INFO [STDOUT] file:/C:/Data/j2sdk1.4.1_01/jre/lib/ext/ldapsec.jar
      2003-02-24 14:55:50,230 INFO [STDOUT] file:/C:/Data/j2sdk1.4.1_01/jre/lib/ext/localedata.jar
      2003-02-24 14:55:50,230 INFO [STDOUT] file:/C:/Data/j2sdk1.4.1_01/jre/lib/ext/sunjce_provider.jar

      is this normal ? and is there a workaround ?

      thanx for help.

      seb.

        • 1. Re: reflection w/ jboss-3.0.6

          There is a change in 3.0.6 to make one classloader
          for the whole ear, rather one for each jar in the
          deployment. But all classes should be available
          in the Unified Loader Repository.

          Try using the application classloader
          Thread.currentThread().getContextClassLoader().loadClass()

          Class.forName() effectively does
          getClass().getClassLoader().loadClass()
          which depends upon where the current class is packaged.

          Regards,
          Adrian