Java Reference
In-Depth Information
At this point we are shown a list of all open projects that have EJBs in them. We need
to select the bean we wish to access from one of these projects.
Had our bean had both a local and remote interface, we would have been given the
choice to select the appropriate one. However, since it only has a remote interface,
the option to select a local interface is disabled. In our particular example, even if we
had the option of selecting a local interface, the correct option would have been to
select the remote interface since our client will be executing in a different JVM from
the server, and local interfaces are not accessible across JVMs.
At this point a member variable of type EchoBeanRemote (our bean's remote
interface) is added to the client. This variable is annotated with the @EJB annotation.
This annotation is used to inject the instance of the remote interface at runtime.
In previous versions of J2EE, it was necessary to perform a JNDI lookup
to obtain a reference to the home interface of the bean, then use the home
interface to obtain a reference to the remote or local interface. As we
can see, the procedure to obtain a reference to an EJB has been greatly
simplified in Java EE 5.
 
Search WWH ::




Custom Search