Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6951681

java.lang.reflect.Proxy object cannot be marshalled over RMI-IIOP

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.6.0_14"
      Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
      Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Running server on Windows_NT
      uname -a
      Windows_NT **** 5 01 586

      Running client on Linux:
      bash-3.2$ uname -a
      Linux **** 2.6.18-128.el5xen #1 SMP Wed Jan 21 09:07:41 EST 2009 x86_64 x86_64 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      I have a server program registered on the orb, and a client looking up the remote object. When I pass a java.lang.reflect.Proxy object from the server to the client, I get the following exception (see below):

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      I have a simple reproducer (code below). Please let me know if you want any more info.


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      WARNING: "IOP00810257: (MARSHAL) Could not find class"
      org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe
              at com.sun.corba.se.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:8260)
              at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1013)
              at com.sun.corba.se.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:253)
              at _RServer_Stub.getPC(_RServer_Stub.java:38)
              at ProxyIIOPBreakage.main(ProxyIIOPBreakage.java:24)
      Caused by: java.lang.ClassNotFoundException
              ... 4 more
      Exception in thread "main" java.rmi.MarshalException: CORBA MARSHAL 1398079745 Maybe; nested exception is:
              org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe
              at com.sun.corba.se.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:197)
              at javax.rmi.CORBA.Util.mapSystemException(Util.java:67)
              at _RServer_Stub.getPC(_RServer_Stub.java:49)
              at ProxyIIOPBreakage.main(ProxyIIOPBreakage.java:24)
      Caused by: org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe
              at com.sun.corba.se.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:8260)
              at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1013)
              at com.sun.corba.se.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:253)
              at _RServer_Stub.getPC(_RServer_Stub.java:38)
              ... 1 more
      Caused by: java.lang.ClassNotFoundException


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Server code:

      class Server
        implements RServer
      {
        public Server(Hashtable properties)
          throws Throwable
        {
          PortableRemoteObject.exportObject(this);

          Context context = new InitialContext(properties);
          context.rebind("server", this);
        }

        public Proxy getPC() {
          Sum sum = new Sum(new Integer(1), new Integer(2));

          Handler handler = new Handler(sum);

          Class[] interfacesArray = new Class[] {ISum.class};

          return ((Proxy) Proxy.newProxyInstance(Sum.class.getClassLoader(), interfacesArray, handler));

        }
      }

      Client code:

      public class ProxyIIOPBreakageClient
      {
        public static void main(String[] args)
          throws Throwable
        {
          Hashtable properties = new Hashtable();
          properties.put("java.naming.factory.initial",
                         "com.sun.jndi.cosnaming.CNCtxFactory");
          properties.put("java.naming.provider.url", "iiop://10.148.122.143:3700");


          Context context = new InitialContext(properties);
          Object ref = context.lookup("server");
          RServer server = (RServer) PortableRemoteObject.narrow(ref, RServer.class);

          Object gotpc = (Object) server.getPC();
          System.err.println(gotpc);
        }
      }

      Common interface:
      interface RServer
        extends Remote
      {

        Proxy getPC()
          throws RemoteException;

      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      We wrap the Proxy object in a wrapper class called ProxyDesc. This has a readResolve method, which reconstructs the Proxy on the other side.

      This is the same issue discussed here (in 2004):

      http://www.omg.org/issues/issue7595.txt

      I am wondering if there is a plan to allow marshalling Proxy object over RMI-IIOP

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: