2 Replies Latest reply on Feb 12, 2004 12:24 AM by chamarts

    rmi/iiop stub download

    weigq

      Jboss supports rmi/iiop.
      The implementation will download the rmi/iiop stubs automatically from server.
      How can I add rmi/iiop stubs generated by rmic directly to the CLASSPATH, avoiding downloading stubs' bytecode?
      I try this,but the VM through ClassCastException.
      How to do this?
      Thanks

        • 1. Re: rmi/iiop stub download
          reverbel

          You're probably getting ClassCastExceptions due to a bug in Sun's implementation of the method javax.rmi.CORBA.Util.isLocal(). Stubs generated with the rmic tool call this method
          to check is the call is a local invocation, which they can optimize. However, Sun's implementation of isLocal() tries to cast the stub to a proprietary class. This is against the rules. Since the ORB is pluggable ("-Dorg.omg.CORBA.ORBClass=...), Sun's implementation of a standard (javax.rmi) method should not assume that the stubs are Sun stubs.

          The workaround for this bug is to replace Sun's implementation of the interface javax.rmi.CORBA.Util. Use the switch

          "-Djavax.rmi.CORBA.UtilClass=my.bugfix.FixSunDelegateBug"

          where my.bugfix.FixSunDelegateBug is the following class:

          package my.bugfix;
          
          public class FixSunDelegateBug
           extends com.sun.corba.se.internal.iiop.ShutdownUtilDelegate
          {
           public boolean isLocal(javax.rmi.CORBA.Stub stub)
           throws java.rmi.RemoteException
           {
           try
           {
           org.omg.CORBA.portable.Delegate delegate = stub._get_delegate();
           return delegate.is_local(stub);
           }
           catch (org.omg.CORBA.SystemException e)
           {
           throw javax.rmi.CORBA.Util.mapSystemException(e);
           }
           }
          }
          


          This workaround is for Sun JDK 1.4.x.

          Regards,

          Francisco


          • 2. Re: rmi/iiop stub download

            i tried to follow the above mentioned work around to get rid of
            ClassCastException using the below command

            java "-Djavax.rmi.CORBA.UtilClass=client.BugFix" client.SampleClient

            i tried work around but doesnt seem to be working or even get called.

            But i see the same exception .... ClassCastException...

            am i missing something here ?? any ideas ??

            regards,
            Keith