JDK-4666095 : ClassCastException exception throws when access a remote EJB using RMI-IIOP
  • Type: Bug
  • Component: other-libs
  • Sub-Component: corba:orb
  • Affected Version: 1.3.1
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2002-04-10
  • Updated: 2004-01-21
  • Resolved: 2004-01-21
Related Reports
Duplicate :  
Description
###@###.### 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.

Comments
WORK AROUND 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); } }
11-06-2004

EVALUATION Will see if it is feasible to fix in Tiger Timeframe. In the Description, I see the following statement. "Not carefully test the workaround - but it works for now.", by this I assume it works now and please test this with Tiger also. For now, I'll close this bug. ###@###.### 2004-01-15
15-01-2004