2.3 The J2EE Application Server
Now that we've introduced the J2EE components, let's take a closer look at the J2EE platform. Figure 22 shows a more detailed view of the J2EE architecture.
Figure 22 J2EE Application Server and Containers
Containers and Services
Both the presentation and middle tiers use containers. An application client container runs on the client machine and manages the execution of client programs. In the J2EE server machine, a web container manages JSP and servlet components. The EJB container, which also runs on the J2EE server machine, manages the execution and life cycle of all enterprise beans. The browser is an applet container and runs on the client machine.
Why are containers important in the J2EE application server? Rather than have client programs handle the complex details of transaction and state management, multithreading, and resource pooling, the web and EJB containers provide these services in the middle tier. This arrangement makes thin clients possible and centralizes the important aspects of distributed computing in a dedicated server or cluster of servers.
All J2EE components, regardless of whether they are web components, enterprise beans, or application components, must be assembled into a J2EE application and deployed in their containers before executing. This assembly process involves specifying container settings for each component that is to be deployed.
Part of the packaging of EJB components involves the creation of a deployment descriptor. Deployment descriptors are XML-based files that describe how the container configures a bean to run on a server. In the deployment descriptor, you may specify settings for security, transactions, JNDI lookups, environment resources, and much more. The deployment descriptor is important because it affects the behavior of an EJB. By changing an EJB's deployment descriptor, you can make an EJB behave differently. We show you how to customize EJBs through the deployment descriptor (see "Naming Environment Entry" on page 124 in Chapter 4).
The containers also manage other types of services, such as EJB and servlet life cycles, database connection resource pooling, data persistence, transaction management, and security.
With this introduction to the J2EE architecture and its components, let's take a closer look at EJB components in the middle tier. We'll discuss the different types of enterprise beans and how the EJB container manages them in enterprise designs.