3 Replies Latest reply on Oct 9, 2002 3:35 AM by yusdi

    Challenging Class Loading problem

    yusdi Newbie

      Hi guys,

      I have quite a unique problem with JBoss. The scenario is described as follow:
      1. we have 2 servers, both deployed with the same version of EJB (A).
      2. Server 1 lookup an object (B) through JNDI, this object is bind to local JNDI through an MBean.
      3. Server 1 invoke a method in the object (B) that actuall communicate with the object (B) in server 2.
      4. The object (B) in server 2 is supposed to create an instance of class A in server 2. This is performed by :
      Class.forName( ) where the name of class A is transmitted to server 2.

      So far so good...
      The problem comes when I redploy EJB (A) in server 1 and server (2) with newer version without redploying the MBean,
      if I repeat step 1 to 4, at step 4, the server 2 will throw ClassCastException or class not compatible , due to the fact that it still uses the older version of the class loaded by its class loader.

      I have looked at UnifiedClassLoader architecture and faguely convinced that if I can change the Class.forName with loading from the UnfiedClassLoader I might be able to solve this. But I could not find any information on how to load the latest version of the class given the classname.

      FYI: this application is used for building Java based message passing API (something like MPI) on top of JBoss. This is the last missing piece, for now I have to restart the server everytime I deploy newer version of the bean.