Chapter 17. J2EE Application Servers

Application servers provide a reliable, scalable, and secure environment in which applications execute. In the Java context, an application server is a platform that implements the J2EE (Java 2 Enterprise Edition) contracts to support applications.

Because of security concerns, many web sites do not allow servers directly facing the Internet to handle business transactions directly. Instead, web servers delegate the more important transactions to an application server isolated from the Internet by firewalls and/or additional layers of code. This architecture minimizes the threat of attacks on the core business infrastructure.

Application servers provide functionality defined strictly by the J2EE platform, typically a superset of functionality provided by web servers. In addition to supporting applications written to the Servlet and JSP contracts, application servers support the EJB (Enterprise JavaBeans) architecture, allowing application-server components to be written as distributed objects. Trusted clients and servlets and JSP pages running in the same or different servers can access these objects directly.

An application server that implements the J2EE contracts also provides a number of services required by applications. There are many more services available, but the following are the most important from the JDO developer's viewpoint:

JDBC

Provides access to datastores via a standard protocol.

JNDI (Java Naming and Directory Interface)

Provides a binding between names of services and the instances that implement those services. For example, the name of a JDBC DataSource resource might be java:comp/env/jdbc/HumanResources and its implementation might be a DataSource bound to the human-resources database.

JTS (Java Transaction Service)

Coordinates local and distributed transactions to guarantee the atomicity of transactions that span different resources and processes.

JavaMail

Provides a programming interface to create and send email messages.

JMS (Java Message Service)

Offers a means for applications to send and receive asynchronous messages in transactional contexts.

The EJB architecture is a component architecture for developing and deploying distributed business applications. In this chapter, we take a look at some common design patterns for implementing multitier applications. This book is not intended to be a reference for patterns, but the examples illustrate some popular access methods.