9
3
|
I understood that Local interface is designed for clients in the same container's JVM instance and remote interface is designed for clients residing outside the EJB container's JVM. How about the web application client which is not reside (or packaged) in the same .ear but reside on the same Java EE server?
| |||
add comment |
11
|
Officially
@Local annotated beans can only be accessed if they're in the same application. A .war deployed separately from an .ear (or other .war or other .jar EJB) is a different application, even when deployed to the same application server instance.
There's thus no guarantee that the code in your .war can call
@Local EJB beans that are defined in the .ear.
However, in practice in nearly all application servers this just works.
There's a request for the EJB 3.2 spec to officially support local cross-application calls:http://java.net/jira/browse/EJB_SPEC-22
| ||||||||||||
|
2
|
Local interfaces are to be used in communication within the same application. It doesn't necessarily mean JVM.
The point is: even within the same JVM instance, on the same server, two different applications cannotcommunicate using local interfaces (which means local and no-interface views).
If you have a web component (WAR) as well as a business component (EJB-JAR) which is in the same application, the most intuitive and straightforward solution is to package them in one EAR or in one WAR (since Java EE 6).
| ||||||||||||
|
same J2EE server
? Is it deployed on the same instance, in the same domain?– jFrenetic Dec 15 '11 at 20:35@EJB
annotation to inject ejbs into JSF managed-beans works. – Bhesh Gurung Dec 15 '11 at 22:15