Show TOC Start of Content Area

Background documentation Return of an Unexpected Class Type After a Lookup Operation  Locate the document in its SAP Library structure

Analysis

A lookup operation of an object from a server-side client (application, service, library) returns an unexpected object type.

Scenario Type: Error analysis

SAP NetWeaver Component: Application Server Java (AS Java)

Syntax

Example:

Context jndiCtx = new InitialContext();

Object object = jndiCtx.lookup(“objectName”);      

LookedUpObjectInterface result = (LookedUpObjectInterface)  PortableRemoteObject.narrow (object, LookedUpObjectInterface.class);

 

Throws:

java.lang.ClassCastException: com.sap.engine.interfaces.cross.ObjectReferenceImpl

at com.sap.engine.services.cross.PortableRemoteObjectContainer.narrow(PortableRemoteObjectContainer.java:154)

at com.sap.engine.system.PortableRemoteObjectProxy.narrow(PortableRemoteObjectProxy.java:24) ...............

 

or:

java.lang.ClassCastException: com.sap.engine.services.naming.persistent.UnsatisfiedReferenceImpl

at com.sap.engine.services.cross.PortableRemoteObjectContainer.narrow(PortableRemoteObjectContainer.java:154)

at com.sap.engine.system.PortableRemoteObjectProxy.narrow(PortableRemoteObjectProxy.java:24) ...............

 

Analysis

To be able to load the looked-up object, the client must have a class loader reference to the component that has bound this object.

Solution

Check if the client has a class loader reference to the component that has bound the object. If it does not, put a class loader reference.

End of Content Area