I have an EJB and WAR deployed in same domain on Glassfish 3.1.2 where the WAR dependency is the EJB's client jar generated by Maven. The EJB has TestSessionBean and its Local interface TestSessionBeanLocal.
How do I look this up in the WAR. I have tried usring @EJB with no success.
If you have deployed independently your ejb module and your war module, you have to expose your EJB with a remote view (@Remote) in order to inject it in the war module. But if you have packaged your EJB and war modules in an enterprise archive (ear), the local view or the no-interface view are efficients.
Alexandre Sbriglio - Marseille
SCJP 6 / OCP BCD5
Joined: Feb 09, 2002
Even @Local is sufficient as long as the EJB and the client are in the same JVM. @Remote is used when you deploy separately.
What do you think ?
Joined: Mar 12, 2012
thanks for the reply. Engin what di you mean by same JVM w.r.t to Glassfish. Same domain == JVM? I do not think this is the case.
Joined: Jun 09, 2011
I don't think we must think in therm of JVM co-location (/or glassfish domain) to choose between remote or local client view. We must think in therm of application co-location :
If the client is packaged in the same application (ejb-jar, war, ear) than the session bean, this client can access the bean through his local business interface, otherwise if the the client is not in the same application, it must access through the remote interface.
So if we deploy separate war and ejb modules, we have 2 separate applications.
the EJB 3.1 says about local client view :
Access to an enterprise bean through the local client view is only required to be supported for local clients packaged within the same application as the enterprise bean that provides the local client view. Compliant implementations of this specification may optionally support access to the local client view of an enterprise bean from a local client packaged in a different application. The configuration requirements for inter-application access to the local client view are vendor-specific and are outside the scope of this specification.
If i don't mistake a glassfish domain is a server instance running in a JVM, in the case of a non clustered domain.