PQ53224: EJB CALL-BY-REFERENCE (NOLOCALCOPIES) GETS JAVA.RMI.REMOTEEXCEPTION: JAVA.LANG.CLASSCASTEXCEPTION

APAR status
Closed as program error.

Error description
Customer is migrating from WAS 3.5.3 to WAS 3.5.4. Part of the
migration is to begin storing Handle to EJBObjects instead of
the references to the EJB. Customer's codebase requires to
run WAS EJB in "call-by-reference" mode using the application
server's command line arguments:
    -Djavax.rmi.CORBA.UtilClass=com.ibm.CORBA.iiop.Util
    -Dcom.ibm.CORBA.iiop.noLocalCopies=true
Here is the program flow and the problem encountered:
Stateful SessionBeanA creates a reference Stateful SessionBeanB
(call it refB), and is able to call methods on SessionBeanB
using refB. SessionBeanA then calls refB.getHandle(), which
returns a SessionHandle object.
SessionBeanA  next calls refB.getHandle().getEJBObject().
This calls private method SessionHandle.getReference(), which
throws a ClassCastException when trying to cast the EJBObject
to javax.rmi.CORBA.Stub because the EJBObject is of type
EJSRemoteSessionBeanName instead of _SessionBeanName_Stub.
I believe the "pass by reference" flags we use are causing
the different object class to be referred to by the
SessionHandle. If we remove the "pass by reference" options,
SessionHandle contains a  _SessionBeanName_Stub.
.
The method SessionHandle.getReference() was added in WAS 3.54
(WAS 3.5.3 version of SessionHandle works for us because it
does not attempt to cast to javax.rmi.CORBA.Stub).
Local fix
Customer decompiled the SessionHandle class and changed the
SessionHandle.getReference code to add the following "if"
statement before calling _orb() :
  if ( object instanceof javax.rmi.CORBA.Stub) {
    ((javax.rmi.CORBA.Stub)object)._orb();
  }
and this works.
Problem summary
****************************************************************
* USERS AFFECTED: Websphere Application Server users using     *
*                 the noLocalCopies=true parameter for         *
*                 non-standard ORB call-by-reference           *
*                 implementations.                             *
****************************************************************
* PROBLEM DESCRIPTION: In 3.5.4, SessionHandle throws          *
*                      ClassCastException if the               *
*                      "Pass by Reference" flag is turned      *
*                      on in the server.                       *
****************************************************************
* RECOMMENDATION:                                              *
****************************************************************
The application runs correctly when the user doesn't specify the

following parameters in the command line arguments of the
application server:
      -Djavax.rmi.CORBA.UtilClass
  =com.ibm.CORBA.iiop.Util
-Dcom.ibm.CORBA.iiop.noLocalCopies
  =true
in 3.5.4.
A change that was apparently made in 3.5.4 to the SessionHandle

class, where a cast is now being made inside SessionHandle that
wasn't done in 3.5.3.  This change caused SessionHandle to
start throwing a ClassCastException if the "Pass by Reference"
flag is turned on in the server, which is the mode that the
customer was using in 3.5.3 and prior.
Problem conclusion
Code change made on 3.5.4 base to handle this exception.
Changed code to store the EJBObject stub in the handle
rather than the EJBObject reference.
Temporary fix Comments
APAR information
APAR number PQ53224
Reported component name WEBSPHERE AE SO
Reported component ID 5630A2202
Reported release 400
Status CLOSED PER
PE NoPE
HIPER NoHIPER
Submitted date 2001-10-09
Closed date 2001-10-09
Last modified date 2001-10-09

APAR is sysrouted FROM one or more of the following:
PQ51760

APAR is sysrouted TO one or more of the following:

Modules/Macros
EJS          

Fix information
Fixed component name WEBSPHERE AE SO
Fixed component ID 5630A2202

Applicable component levels
R400 PSY    UP


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > General
Operating system(s):
Software version: 400
Software edition:
Reference #: PQ53224
IBM Group: Software Group
Modified date: Oct 9, 2001