Skip to Content
0
Former Member
Jan 29, 2014 at 04:05 PM

InitialContext lookup of EJB, ClassCastException

76 Views

Hello,

i am trying to look up a EJB in my REST Service. Both deployed on the same server. The problem is that i am getting a Object of Type Proxy from the lookup method and can't cast it to the needed Bean Class. Any ideas?

Here the code:

//This returns the Proxy Object?!

Object obj = new

InitialContext().lookup("ejb:/mycompany.de/reboard~report~cs/REMOTE/com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedEjb/com.sap.bpem.facade.api._simplified.adapted.BPMFacadeBeanSimplifiedRemote");

//Class cast excpetion here!

BPMFacadeBeanSimplifiedRemote myBean = (BPMFacadeBeanSimplifiedRemote) PortableRemoteObject.narrow(obj, BPMFacadeBeanSimplifiedRemote.class);

Thanks for help!