WebLogic Server Components

Enterprise JavaBeans (EJBs)

Enterprise JavaBeans are reusable software programs that you can develop and assemble easily to create sophisticated applications. Developers use EJBs to design and develop customized, reusable business logic. EJBs are the units of work that an application server is responsible for and exposes to the external world. The WebLogic Application Server provides the architecture for writing business logic components, allowing Web servers to easily access data.

There are three types of Enterprise JavaBeans:

Session Beans

Session Beans are business process objects that perform actions. An action may be opening an account, transferring funds, or performing a calculation. Session Beans consist of the remote, home, and bean classes. A client gets a reference to the Session Bean's home interface in order to create the Session Bean remote object, which is essentially the bean's factory. The Session Bean is exposed to the client with the remote interface. The client uses the remote interface to invoke the bean's methods. The actual implementation of the Session Bean is done with the bean class.

Entity Beans

Entity Beans are data objects that represent the real-life objects on which Session Beans perform actions. Objects may include items such as accounts, employees, or inventory. An Entity Bean, like a Session Bean, consists of the remote, home, and bean classes. The client references the Entity Bean's home interface in order to create the Entity Bean remote object (essentially the bean's factory). The Entity Bean is exposed to the client with the remote interface, which the client uses to invoke the bean's methods. The implementation of the Entity Bean is done with the bean class.

Message Driven Beans

Message Driven Beans (MDBs) are messaging objects designed to route messages from clients to other Enterprise Java Beans. In the WebLogic adapter, MDBs are only supported with asynchronous communication with JMS. However, Message Driven Beans deal with asynchronous subscription/publication of JMS messages in a different manner than Entity and Session Beans (EJB 2.0 specification). Message Driven Beans are often compared to a Stateless Session Bean in that it does not have any state context. A Message Driven Bean differs from Session and Entity Beans in that it has no local/ remote or localhome/home interfaces. An MDB is not exposed to a client at all. The MDB simply subscribes to a Topic or a Queue, receives messages from the container through the Topic or Queue, and then process the messages it receives from the container.

An MDB implements two interfaces:

Minimally, the MDB must implement the setMessageDrivenContext, ejbCreate, and ejbRemove methods from the javax.ejb.MessageBean interface. In addition, the MDB must implement the onMessage method of the javax.jms.MessageListener interface. The container calls the onMessage method, passing in a javax.jms.Message, when a message is available for the MDB.