TopBanner

Content

Chapter 1: J2EE Technology

Java 2 Enterprise Edition (or J2EE for short) is a platform developed by Sun Microsystems which lets developers write server-side applications and components. J2EE is a superset of the J2SE (Java 2 Standard Edition) - the standard Java platform and APIs - in that is adds serveral APIs and certain specifications defining component life cycles and interfaces to server processes.

What is a J2EE Application Server?

A J2EE Application Server (or J2EE AppServer for short) is a program that controls a set of containers, that maintain runtime environments ("contexts") and enforce the standard life-cycle of J2EE components. Containers act as an intermediary between the server process or operating system and its contained components, providing isolation to improve overall stability in case of bad J2EE component behavior/malformed code. There are three types of J2EE container:

  1. Web Container. These containers provide services and environment properties for Web Applications.
  2. Enterprise JavaBean Container. These containers hold business logic deployed in Enterprise JavaBeans (EJB) JAR components. EJB JARs contain Enterprise JavaBean classes and required configuration documents.
  3. Resource Container. These containers wrap connectors that permit EIS (Enterprise Information Systems) to communicate seamlessly with other J2EE components within the J2EE AppServer.

What are J2EE components?

J2EE components are JAR-style archives with a strict internal structure. All compiled Java classes of a J2EE application is packaged in J2EE components, which execute within containers inside a J2EE application server.

The image right illustrates the skeleton of a J2EE EJB JAR component - the grey container represents the JAR file, the white boxes inside it directories and the rounded, red boxes represent files. The META-INF and se directories both reside in the root of the archive; the skeleton EJB JAR contains the class se.jguru.test.Test and its configuration documents ejb-jar.xml and orion-ejb-jar.xml.

In general, J2EE components consist of sets of compiled Java classes, any required resources (images, libraries etc.), and required XML configuration documents (known as deployment descriptors). As JAR-style archives contain a mandatory top-level directory (META-INF) holding a manifest file (MANIFEST.MF), J2EE components use that directory structure to contain the deployment descriptors. For web applications, the configuration directory is called WEB-INF instead of META-INF.

In J2EE lingo, configuration documents are called deployment descriptor. Packaging and deployment descriptors are discussed in detail in Chapter 2: J2EE Packaging and Deployment.

There are four types of J2EE component:

  1. Enterprise Applications. These components provide a top-level structure which contains any number of other J2EE components (except other J2EE Enterprise Applications). The JAR file holding an enterprise application has the suffix .ear, so Enterprise Applications are frequently referred to as EARs.
  2. Web Applications. These J2EE components may contain Servlets, Java ServerPages, Tag Library Definitions and plain Java classes or resources as required for proper operation. The documents and Java classes of Web Applications frequently create markup language (HTML, WML, XML, etc.) responses to requests from web browsers or business applications. The JAR file holding a Web application has the suffix .war, so WebApps are frequently referred to as WARs.
  3. Enterprise JavaBean Applications. These components hold server-side business logic packaged within Enterprise JavaBeans.
  4. Resource Applications. These J2EE components hold Java classes that act as drivers or communication gateways to Enterprise Information Systems (EISs). It is highly likely that the manufacturer of an EIS packages its driver into a J2EE resource archive (RAR).