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

PortableRemoteObject.toStub() does not work with POA stubs/ties

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • rmi-iiop_fcs
    • other-libs
    • None
    • sparc
    • solaris_1

      If you compile the stubs/ties for a remote object, with the -poa flag turned on,
      you cannot use the PortableRemoteObject.toStub() call to get the stub for that object. The toStub() calls returns a class cast exception. On the other hand, if you compile it without this flag turned on, toStub() returns the Stub object.

      Here's the ClassCastException that is seen when using the toStub() call.

      is it friday yet ;) java -Dorg.omg.CORBA.ORBClass=com.sun.corba.ee.internal.POA.POAORB -Dorg.omg.CORBA.ORBSingletonClass=com.sun.corba.ee.internal.corba.ORBSingleton -Dorg.omg.CORBA.ORBInitialHost=javalite -Dorg.omg.CORBA.ORBInitialPort=10000 IsLocalTests
      Warning: JIT compiler "none" not found. Will use interpreter.
      Caught exception: _IsLocalImpl_Tie
      java.lang.ClassCastException: _IsLocalImpl_Tie
              at com.sun.corba.ee.internal.util.Utility.loadStubAndUpdateCache(Utility.java:539)
              at com.sun.corba.ee.internal.util.Utility.loadStub(Utility.java:434)
              at com.sun.corba.ee.internal.javax.rmi.PortableRemoteObject.toStub(PortableRemoteObject.java:148)
              at javax.rmi.PortableRemoteObject.toStub(PortableRemoteObject.java:104)
              at IsLocalTests.run(IsLocalTests.java:58)
              at IsLocalTests.main(IsLocalTests.java:103)

      I have also attached the test code that I used.

      *******************************************************************************

      tuong.nguyen@eng 2000-12-18

      A simple rmi-iiop Client/Server program that compiled with "rmic -iiop -poa ..."
      still yielded the same exception when the Server started.

      >>>>> /usr/local/java/jdk1.4/solsparc/bin/java -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory -Djava.naming.provider.url=iiop://localhost:1050 -classpath /Tuong/RIP_TEST_MASTER/workdir/classes product.rmiiiop.JavaToIdlMapping.PortabilityInterfaces.stub01.Server &
      Server: InitialContext() OK ..
      Server: >>> EXCEPTION >>> Problem with PortableRemoteObject.toStub(); object not exported or stub not found

      javax.naming.ConfigurationException: Problem with PortableRemoteObject.toStub(); object not exported or stub not found. Root exception is java.lang.ClassCastException: product.rmiiiop.JavaToIdlMapping.PortabilityInterfaces.stub01._RemoteInterfaceImpl_Tie
              at com.sun.corba.se.internal.util.Utility.loadStubAndUpdateCache(Utility.java:643)
              at com.sun.corba.se.internal.util.Utility.loadStub(Utility.java:538)
              at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.toStub(PortableRemoteObject.java:147)
              at javax.rmi.PortableRemoteObject.toStub(PortableRemoteObject.java:103)
              at java.lang.reflect.Method.invoke(Native Method)
              at com.sun.jndi.toolkit.corba.CorbaUtils.remoteToCorba(CorbaUtils.java:83)
              at com.sun.jndi.cosnaming.RemoteToCorba.getStateToBind(RemoteToCorba.java:64)
              at javax.naming.spi.NamingManager.getStateToBind(NamingManager.java:845)
              at com.sun.jndi.cosnaming.CNCtx.callBindOrRebind(CNCtx.java:536)
              at com.sun.jndi.cosnaming.CNCtx.rebind(CNCtx.java:649)
              at com.sun.jndi.cosnaming.CNCtx.rebind(CNCtx.java:666)
              at javax.naming.InitialContext.rebind(InitialContext.java:366)
              at product.rmiiiop.JavaToIdlMapping.PortabilityInterfaces.stub01.Server.main(Server.java:66)

      ********************************************************************************

            rjeyaramsunw Ram Jeyaraman (Inactive)
            nkesavansunw Nandkumar Kesavan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: