This code:
Object o = ctx.lookup("java:comp/env/ejb/AdderEJB"); AdderLocalHome home = (AdderLocalHome)o;
generates a ClassCastException. The object returned from the JNDI lookup is something like com.example.ejb.AdderLocalHomeImpl0@1374bef, and I'm trying to cast it to the interface com.example.ejb.AdderLocalHome.
The local reference to the EJB is as follows:
<server-component-ref> <description> </description> <name>ejb/AdderEJB</name> <type>interface</type> <jndi-name>localejbs/example.com/test-ear/AdderBean</jndi-name> </server-component-ref>
Why am I getting a casting exception? I believe I'm following the documented methods correctly, but I must be doing something wrong.
BTW, this EJB has also been exposed via a web service, and that functions correctly, so I know the EJB is correctly configured and deployed.
Ideas?