J2EEOnline J2EE





EJB Architecture  «Prev  Next»
Lesson 1

Introduction to Distributed Applications and Components

In order that you fully understand how to write Enterprise JavaBeans (EJBs), it is important that you understand where they reside.
In this module, I will create a map of the world in which distributed objects and constructors provide useful services to client programs.
This introduction will let you find your way within the technology that is introduced in the rest of the course.

Understanding the Territory

I will explain how a client program communicates with a remote object , and how it makes use of the services it provides. I will identify the properties of a reusable component, and describe how they can be connected together so that you can build flexible applications.
I will explain the function of servers, containers, and Object Monitors (OMs). You will be introduced to transactions within this world of distributed objects. You will learn about the deployment of remote objects and how they get information about local resources , such as the names of the local databases.
Carefully read this section in preparation for the tutorial on Enterprise Java Beans.The information in this section is the foundation for all that follows.


  1. Message: Another name for a method call. Conveys the idea that the method call is invoked across a network.
  2. Distributed object: An object somewhere on the network that provides some service that is known and available to clients.
  3. constructor:A pseudo-method that creates an object.
  4. Remote object: An object that provides a service through its methods and is located on another host on the network. The location ofthe object needs to be known before its methods can be called.
  5. Component: A physical and replaceable part of a system that conforms to and provides a realization of a set of interfaces.
  6. Object monitor: The combination of remote object together with the environment that manages it and that allows method calls to the remote object.
  7. Local resource: A resource, such as a database connection, that is accessible without traversing the network.
In the next lesson, clients and remote objects will be introduced.

There are also some potential value-adds that a container may provide, possibly separately from its core model:
  1. Enterprise services: Providing transaction management or other declarative services to objects running in the container. These may be declarative.
  2. Thread management: A container may offer a threading model for access to managed objects.
  3. Object pooling: A container may provide instance pooling for managed objects.
  4. Clustering: A container may itself provide clustering support, in which clients can transparently communicate with peer containers, as with EJB clustering. Note that this is often unnecessary when using clustering support at whole application deployment level, in which all application components are deployed on each machine. Container-level clustering is necessary to support a stateful component model such as stateful session beans, but is less important when managed objects are stateless.
  5. Management: A container may provide management services for objects running within it, such as a management console or possibly management via JMX.
  6. Remoting: This can be divided into two services. Today there are multiple potential wire protocols, with no clear winner (although SOAP-based web services seem to be growing in popularity).
  7. Exposing remote services: Providing remote access to objects running in the container. This model is demonstrated by remote EJBs, an excellent remoting technology where RMI/IIOP is concerned.
  8. Consuming remote services: Providing transparent access to remote objects running outside the container.
  9. Customization and extensibility: Allowing custom services to be applied to objects running in the container: for example, custom declarative services such as special security checks.