1 Reply Latest reply on Apr 4, 2005 11:11 AM by Tom Elrod

    configuration of RMI dynamic classloading

    Mario Winterer Newbie


      I'm currently working on a simple EJB application using EJB 3.0. One design goal is to not have any EJB-related code on the client - not even the remote interfaces! But for some reason, dynamic classloading does not work as expected.

      The idea is to have a general (non-remote) interface (let's say "Calculator") that is extended by the remote interface (let's say "CalculatorRemote") that does not declare any additional methods.
      The implementation of the "CalculatorRemote" interface is the session bean "CalculatorBean".
      When packaging the client, it only contains the Calculator interface (and the client-implementation of course).
      But when I try to lookup the CalculatorBean inside the client, I get a "ClassNotFoundException: CalculatorRemote".

      /* Calculator */
      public interface Calculator {
       public int add(int a, int b);
      /* CalculatorRemote */
      public interface CalculatorRemote extends Calculator { /* empty */ }
      /* CalculatorBean */
      public class CalculatorBean implements CalculatorRemote {
       public int add(int a, int b) { return a + b; }
      /* client code */
      Calculator calc = (Calculator)ctx.lookup("CalculatorRemote");
      int sum = calc.add(3, 5);

      Shouldn't the CalculatorRemote interface be dynamically loaded from the server? Is dynamic classloading enabled by default or do I have to change some configuration files on JBoss?


        • 1. Re: configuration of RMI dynamic classloading
          Tom Elrod Master

          This behavior is handled by JBoss Remoting, which EJB3 implementation uses for the remote calls. In earlier releases of JBoss Remoting, dynamic classloading was enabled, but did not have any security checks. As of JBoss Remoting 1.0.1 final release, dynamic classloading has been turned off, with the exception of internal loading of marshallers/unmarshallers, until security can be added to authenticate the client in some way. This feature should be added to the next JBoss Remoting release (1.2.0), which will be what the following EJB3 release will be using.