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


APAR

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:server's command line arguments:-Djavax.rmi.CORBA.UtilClass=com.ibm.CORBA.iiop.Util-Dcom.ibm.CORBA.iiop.noLocalCopies=true
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).
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 SessionBeanBusing refB. SessionBeanA then calls refB.getHandle(), whichreturns a SessionHandle object.SessionBeanA next calls refB.getHandle().getEJBObject().This calls private method SessionHandle.getReference(), whichthrows a ClassCastException when trying to cast the EJBObjectto javax.rmi.CORBA.Stub because the EJBObject is of typeEJSRemoteSessionBeanName instead of _SessionBeanName_Stub.I believe the "pass by reference" flags we use are causingthe different object class to be referred to by theSessionHandle. 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 itdoes 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.
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.
application server:-Djavax.rmi.CORBA.UtilClass=com.ibm.CORBA.iiop.Util-Dcom.ibm.CORBA.iiop.noLocalCopies=truein 3.5.4.A change that was apparently made in 3.5.4 to the SessionHandleclass, where a cast is now being made inside SessionHandle thatwasn't done in 3.5.3. This change caused SessionHandle tostart throwing a ClassCastException if the "Pass by Reference"flag is turned on in the server, which is the mode that thecustomer 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 numberPQ51760
Reported component nameWAS ADVANCED SU
Reported component ID5648C8402
Reported release350
StatusCLOSED PER
PENoPE
HIPERNoHIPER
Submitted date2001-08-23
Closed date2001-09-26
Last modified date2001-12-17

APAR is sysrouted FROM one or more of the following:

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

PQ53224

Modules/Macros
EJS
APAR is sysrouted TO one or more of the following:PQ53224Modules/Macros

Fix information
Fixed component nameWAS ADVANCED SU
Fixed component ID5648C8402

Applicable component levels
R350 PSYUP











Document Information

Product categories: Software, Application Servers, Distributed Application & Web Servers, WebSphere Application Server, General
Software version: 350
Reference #: PQ51760
IBM Group: Software Group
Modified date: 2001-12-17