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

ClassCastException exception throws when access a remote EJB using RMI-IIOP

XMLWordPrintable

    • generic
    • generic


      ###@###.### 2002-04-10

      J2SE Version (please include all output from java -version flag):
        *** java -version
        java version "1.4.1-beta"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b06)
        Java HotSpot(TM) Client VM (build 1.4.1-beta-b06, mixed mode)

        *** j2ee -version
        Java 2 Enterprise Edition version 1.3.1, build 1.3.1-b17

      Does this problem occur on J2SE 1.3 or 1.4? Yes / No (pick one)
        Yes

      Operating System Configuration Information (be specific):
        applies to all OSs

      Hardware Configuration Information (be specific):
        applies to all

      Bug Description:
        ClassCastException in
        com.sun.corba.se.internal.iiop.ShutdownUtilDelegate using code described
        in http://java.sun.com/j2se/1.4/docs/guide/rmi-iiop/interop.html while
        accessing a remote EJB using RMI-IIOP using J2EE-SDK 1.3.1 and
        JDK1.4.0/1.4.1

        The bug occurs, if prior to the operation on the home-interface the
        CORBA NameService is resolved - you can illustrate the problem by using
        attached test.sh script.

      Steps to Reproduce (be specific):
        1. Follow the steps described in "Creating a Java RMI-IIOP client
           application" in
           http://java.sun.com/j2se/1.4/docs/guide/rmi-iiop/interop.html
        2. While running the client, the following exception occurs (stack trace
           from another test client)
           Exception in thread "main" java.lang.ClassCastException
           at
      com.sun.corba.se.internal.iiop.ShutdownUtilDelegate.isLocal(ShutdownUtilDelegate.java:39)
           at javax.rmi.CORBA.Util.isLocal(Util.java:262)
           at
      com.pironet.pb.security.server._UserHome_Stub.findByPrimaryKey(Unknown Source)

        A workaround may be patching the ShutdownUtilDelegate class by modifying
        the isLocal method as follows (adding the "instanceof" test):
          public boolean isLocal(javax.rmi.CORBA.Stub stub) throws RemoteException {
              try {
              org.omg.CORBA.portable.Delegate delegate = stub._get_delegate();
              if (!(delegate instanceof ClientSubcontract)) return false;
              return ((ClientSubcontract)delegate).useLocalInvocation( stub );
              } catch (SystemException e) {
                  throw javax.rmi.CORBA.Util.mapSystemException(e);
              }
          }

      Not carefully test the workaround - but it works for now.

            hputtaswsunw Hemanth Puttaswamy (Inactive)
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: