Why only JNDI is used to access remote EJB (different JVM, differente host)? why not use the @ EJB annotation?
In all EJB books mention that you can access remote EJB using @EJB annotation.
Example: http://docs.oracle.com/javaee/7/tutorial/doc/ejb-intro004.htm
32.4.4 Remote Clients
A remote client of an enterprise bean has the following traits.
It can run on a different machine and a different JVM from the enterprise bean it accesses. (It is not required to run on a different JVM.)
It can be a web component, an application client, or another enterprise bean
It can be a web component, an application client, or another enterprise bean.
To a remote client, the location of the enterprise bean is transparent.
The enterprise bean must implement a business interface. That is, remote clients may not access an enterprise bean through a no-interface view.
To create an enterprise bean that allows remote access, you must either:
Decorate the business interface of the enterprise bean with the @Remote annotation:
@Remote public interface InterfaceName { ... }
Or decorate the bean class with @Remote, specifying the business interface or interfaces:
@Remote(InterfaceName.class) public class BeanName implements InterfaceName { ... }
Client access to an enterprise bean that implements a remote business interface is accomplished through either dependency injection or JNDI lookup.
To obtain a reference to the remote business interface of an enterprise bean through dependency injection, use the javax.ejb.EJB annotation and specify the enterprise bean's remote business interface name:
@EJB Example example;
To obtain a reference to a remote business interface of an enterprise bean through JNDI lookup, use the javax.naming.InitialContext interface's lookup method:
ExampleRemote example = (ExampleRemote) InitialContext.lookup("java:global/myApp/ExampleRemote");
The text above is incorrect? I have not seen any code that uses Dependency Injection (@EJB) to access a remote EJB. It is not possible?
Several post say it is not possible to use the @ EJB annotation for calls to remote ejb:
PD: Excuse me. My English is basic.