What classes does a client application need to access EJB?

Sameer Tyagi

It is worthwhile to note that the client never directly interacts with the bean object but interacts with distributed object stubs or proxies that provide a network connection to the EJB container system.

The mechanhism is as follows.

  1. The client uses the JNDI context to get a remote reference (stub) to the home object ( the EJBHome).
  2. It uses the home to get a remote reference (stub) to the EJBs remote object (the EJBObject)
  3. It then invokes business methods on this remote object.
The client needs the remote interface, the home interface, the primary key( if it is an entity bean).

In addition to these, the client would need the JNDI factory implementation, and the remote and home stubs. In some EJB servers the Factory and/or stubs can be dynamically loaded at run time. In other EJB servers they must be in the classpath of the client application.

See also: