Hi !
I deployed a EJB3 session bean (as an EAR1) on the NW7.1.
The aim is to call this EAR1 from another session bean (EAR2), which is also on the server deployed.
The EAR2 bean do I call from a stand allone java client on my PC to test it. The call of the EAR2 from the stand alone client works fine so far, if the EAR1 is called not yet(only for testing) from the EAR2.
The code of the stand allone java client is:
... try{ Properties props = new Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl"); props.put(Context.PROVIDER_URL, "10.253.17.23:50004"); props.put(Context.URL_PKG_PREFIXES, "com.sap.engine.services"); Context ctx = new InitialContext(props); Object o = ctx.lookup("ejb:/interfaceName=de.itinformatik.mes.IFs.WorkerClient1Remote"); WorkerClient1Remote ref = (WorkerClient1Remote)PortableRemoteObject.narrow(o, WorkerClient1Remote.class); System.out.println("-->"+ ref.sayHello()); ...
Now here the code of the EAR2, which should call the EAR1 over its remote interface:
... Properties props = new Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl"); props.put(Context.PROVIDER_URL, "10.253.17.23:50004"); props.put(Context.URL_PKG_PREFIXES, "com.sap.engine.services"); Context ctx = new InitialContext(props); Object o = ctx.lookup("ejb:/interfaceName=de.itinformatik.mes.IFs.WorkerRemote"); WorkerRemote ref = (WorkerRemote) PortableRemoteObject.narrow(o, WorkerRemote.class); return ref.sayHello(); ...
But now, if I call the EAR2 and it continiues to call the EAR1 , I get an exception at the WorkerRemote ref = (WorkerRemote) PortableRemoteObject.narrow(o, WorkerRemote.class) line in the EAR2:
" Caused by: java.lang.ClassCastException: de.itinformatik.mes.IFs.WorkerRemote at com.sap.engine.services.cross.PortableRemoteObjectContainer.narrow(PortableRemoteObjectContainer.java:219)
....
I dont understand, why the call from the EAR2 to the EAR1 is not working.
Can anybody help please ?
I guess there is a hint:
http://help.sap.com/saphelp_nw04/helpdata/EN/4d/993441c73cef23e10000000a155106/frameset.htm
but I cant fix the problem.
many thanks,
Hendrik