How EJB uses RMI
In EJB, a client’s entry point into the enterprise application is nearly always through a reference (stub) to a Remote object. Yes, it is possible, and sometimes necessary, to use a local client (i.e. a client in the same heap as the bean, and which doesn’t use RMI to invoke business methods), but this is for only a few very special cases.
So RMI lies at the heart of most client-to-bean communication. But as you saw a hint of in the first chapter, the EJB architecture is a little more complex than a simple client-to-stub-to-Remote-object scenario. In EJB, the bean—the thing on which the client wants to call business methods—is not Remote!
Plain RMI
RMI in EJB
Get Head First EJB now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.