The EJB technology defines a model for the development and deployment of reusable Java server components, called EJB components.
An EJB component is a nonvisual server component with methods that typically provide business logic in distributed applications. A remote client, called an EJB client, can invoke these methods, which typically results in the updating of a database.
The EJB architecture looks like this:
EJB server EJB Server holds the EJB container, which provides the services required by the EJB component.
EJB client An EJB client usually provides the user-interface logic on a client machine. The EJB client makes calls to remote EJB components on a server and needs to know how to find the EJB server and how to interact with the EJB components. An EJB component can act as a EJB client by calling methods in another EJB component.
An EJB client does not communicate directly with an EJB component. The container provides proxy objects that implement the components home and remote interfaces. The component’s remote interface defines the business methods that can be called by the client. The client calls the home interface methods to create and destroy proxies for the remote interface.
EJB container The EJB specification defines a container as the environment in which one or more EJB components execute. The container provides the infrastructure required to run distributed components, allowing client and component developers to focus on programming business logic, and not system-level code. In EJB Server, the container encapsulates:
The client runtime and generated stub classes, which allow clients to execute components on a remote server as if they were local objects.
The naming service, which allows clients to instantiate components by name, and components to obtain resources such as database connections by name.
The EJB Server component dispatcher, which executes the component’s implementation class and provides services such as transaction management, database connection pooling, and instance lifecycle management.
EJB component implementation The Java class that runs in the server implements the Bean’s business logic. The class must implement the remote interface methods and additional methods for lifecycle management.