EJB3 Local and Remote interfaces

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 cannot communicate 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).


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: https://download.oracle.com/otndocs/jcp/ejb-3_2-fr-spec

Tags:

Java

Jvm

Ejb 3.0