using local interfaces for EJB (session bean)

Hi,

I抳e a question regarding when to use the Local interfaces(EJBLocal and EJBLocalHome) of a enterprise bean. I understand that calls to enterprise bean can be made locally if the client which is invoking is in the same JVM as that of EJB. I抳e written a web client (servlet) which is packaged in a EAR and this servlet is trying to invoke a session bean which is in a ?i>different?EAR using local interfaces. Both the EARs have been deployed in a single server (websphere 6.0 server). It didn抰 work for me this way?.If I package the servlet in the same EAR of session bean then it works fine.

So is this to say that both EARs are not running on the same JVM? Or should it work even if the client and the session bean are in different EARs but in same server?

Can anyone explain me the fundamentals behind this.

Thanks in advance

[878 byte] By [javaguy2007a] at [2007-11-27 8:53:22]
# 1

Local access is only portable within the same .ear.For example, the Java EE SDK and SUN's

application servers have never supported local EJB access from a web/EJB component in a different

.ear.One issue is that local access requires that both the caller and target EJB have the same

classloader.By definition, different Java EE applications have distinct classloaders. In addition,

in Java EE 5 persistence context propagation does not span applications, so it wouldn't work in the

local case.

--ken

ksaksa at 2007-7-12 21:10:32 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
Thanks a bunch for the info.But i think i read in some books/online that Local access can be achieved if client and server projects are in same JVM . So this would mean that if both are in same EJB container? so theoretically it should be able to access. isnt it?
javaguy2007a at 2007-7-12 21:10:32 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
Some Java EE implementations have a way to support local between applications running in thesame JVM but it's not portable.The recommended approach is to access EJB Local access froman EJB or web component packaged within the same .ear.
ksaksa at 2007-7-12 21:10:33 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...