0 Replies Latest reply on Feb 28, 2007 11:10 AM by Adam Wasserman

    RMI Classloading

    Adam Wasserman Newbie

      I'm curious and I hope I don't sound too stupid by asking this question.

      I have a system that involves in its simplest form 2 subsystems, each of which is hosted on a separate machine running JBoss 4.0.5.GA. It happens that a component hosted in subsystem A wants to send a message to a queue hosted in subsystem B. Now I realize that it is possible to configure a remote connection factory in jms-ds.xml (I'm using JBoss Messaging, by the way) and this works fine. Perhaps it's even preferrable because the connections are pooled.

      However, it should also be possible to create an InitialContext referencing the remote machine directly, as any free-standing component would do (and, in fact, this works fine, since the class loading hierarchy is simpler and the necessary classes are available on the client side in jboss-messaging-client.jar). If I try this, however, the lookup call fails with a ClassNotFoundException: org.jboss.jms.client.ClientConnectionFactory with the tag that RMI Classloading is not enabled. This class is the type of the object which we are trying to lookup.

      My impression of what is going on is that, because the JBoss Messaging core classes are loaded by some mysterious ClassLoader which is neither the current not the thread's context ClassLoader, the lookup has no other recourse that to try and download the class definition from the remote server, which it cannot do.

      My question is this: is it expressly forbidden by the J2EE specification to enable RMI Classloading from within a J2EE container? Or is it simply bad practice? Or is it neither of these, in which case, is there way to enable RMI classloading in JBoss?

      Many thanks,
      Adam