[jboss-user] [EJB 3.0] - Trouble accessing local EJB from webapp
mjremijan
do-not-reply at jboss.com
Tue Dec 4 11:06:27 EST 2007
It's been a while since I've worked in the EJB world (been doing a lot of just webapp development lately) so please bear with me.
I am using jboss-4.2.1.GA and java version "1.5.0_11"
I am working on a simple EJB project. I have 1 local session bean an 1 entity bean which is managed by the Java Persistence API. I pack this all up into an ear file and deploy it to jboss. I can see in the JNDIList the ejb is deployed:
| +- oak.oths.domain (class: org.jnp.interfaces.NamingContext)
| | +- AlumniEjb (class: org.jnp.interfaces.NamingContext)
| | | +- local (proxy: $Proxy172 implements interface org.oak.oths.domain.alumni.AlumniLocal,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
|
Now I have a webapp. This webapp is deployed as a seperate war file. Inside the webapp I do a JNDI lookup, find the object, but get a java.lang.ClassCastException when I try to typecast or PortableRemoteObject.narrow() it to the EJB's local interface, AlumniLocal.
| // This causes a ClassCastException!
| AlumniLocal local
| = (AlumniLocal)ctx.lookup("oak.oths.domain/AlumniEjb/local");
|
I can loop over the interfaces which the class implements and it does indeed implement the AdminLocal interface so my question is why am I getting this ClassCastException? If the EJB is in an EAR file and the webapp is deployed as a seperate WAR file can the two not use Local interfaces?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4110238#4110238
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4110238
More information about the jboss-user
mailing list