cancel
Showing results for 
Search instead for 
Did you mean: 

ClassCast-/ObjectNotFoundException while trying to call a CAF EJB from an another EJB

Former Member
0 Kudos

Dear Experts,

we have two EAR DCs

  • pr_test_hc_amd_0~bl~caf~ear: Contains CAF EJB
  • pr_test_hc_amd_0~bl~ear: Contains other EJBs

Both DCs are deployed correctly and have functioning webservices/EJBs, which I can call without a problem. I am trying to call an EJB from CAF EAR in BL EAR.

I looked up in SDN and found following code samples:

1)

String jndiname = "test.ch/pr_test_hc_amd_0~bl~caf~ear/" +

      "ch.test.pr_test_hc_amd_0.bl.caf.modeled.bonode.lockobject.lockobject.LockObject";

LockObjectBean bean = (LockObjectBean )ctx.lookup(jndiname);

2)

String jndiname = "test.ch/pr_test_hc_amd_0~bl~caf~ear/" +

      "ch.test.pr_test_hc_amd_0.bl.caf.modeled.bonode.lockobject.lockobject.LockObject";

LockObjectBean bean = (LockObjectBean ) javax.rmi.PortableRemoteObject.narrow(ctx.lookup(jndiname), LockObjectBean.class);

Both cases I get an Exception:

"Object not found in lookup of ch.insel.pr_insel_hc_amd_0.bl.caf.modeled.bonode.lockobject.lockobject.LockObject."

I read somewhere that I should try a JNDI name with LOCAL so when I try:

String jndiname = "test.ch/pr_test_hc_amd_0~bl~caf~ear/" +

          "LOCAL/" +

          "ch.test.pr_test_hc_amd_0.bl.caf.modeled.bonode.lockobject.lockobject.LockObject";

Then lookup works fine but I get an ClassCastException:

java.lang.ClassCastException: class com.sun.proxy.$Proxy3970:test.ch/pr_test_hc_amd_0~bl~caf~ear@com.sap.engine.boot.loader.ResourceMultiParentClassLoader@2770dd66@alive incompatible with class ch.test.pr_test_hc_amd_0.bl.caf.modeled.bonode.lockobject.lockobject.LockObjectBean:test.ch/pr_test_hc_amd_0~bl~caf~ear@com.sap.engine.boot.loader.ResourceMultiParentClassLoader@2770dd66@alive

at

Now I am stuck I would be happy about any hints.

Thanks a lot,

Koray

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

After a little bit more trial error I could make the call using following code:

String jndiname = "test.ch/pr_test_hc_amd_0~bl~caf~ear/LOCAL/" +

                                        "ch.test.pr_test_hc_amd_0.bl.caf.modeled.bonode.lockobject.lockobject.LockObject/" +

                                        "ch.test.pr_test_hc_amd_0.bl.caf.modeled.bonode.lockobject.lockobject.LockObjectServiceLocal";

Object o = ctx.lookup(jndiname);

LockObjectServiceLocal bean = (LockObjectServiceLocal) PortableRemoteObject.narrow(o, LockObjectServiceLocal.class);

I hope this helps someone having the same problem...

Answers (0)