Prev | Next

TOC | Index

J2EETM Developer's Guide
Overview


J2EE Applications

You assemble a J2EE application from three kinds of modules: enterprise beans, Web components, and J2EE application clients. These modules are reusable-- you can build new applications from existing enterprise beans and components. And because the modules are portable, the application they comprise will run on any J2EE server that conforms to the specifications.

Contents of a J2EE Application

Figure 1-4 shows the hierarchy of a J2EE application. A J2EE application may contain one or more enterprise beans, Web components, or J2EE application client components. An enterprise bean is composed of three class files-- the EJB class, the remote interface, and the home interface. (The next chapter discusses these class files in more detail.) A Web component may contain files of the following types: servlet class, JSP, HTML, and GIF. A J2EE application client is a Java application that runs in an environment (container) which allows it to access J2EE services.

Each J2EE application, Web component, enterprise bean, and J2EE application client has a deployment descriptor. (Figure 1-4 abbreviates a deployment descriptor as DD.) A deployment descriptor is an .xml file that describes the component. An EJB deployment descriptor, for example, declares transaction attributes and security authorizations for an enterprise bean. Because this information is declarative, it can be changed without requiring modifications to the bean's source code. At run time, the J2EE server reads this information and acts upon the bean accordingly.

FIGURE 1-4 Contents of a J2EE Application

You bundle each module into a file with a particular format-- a J2EE application in a .ear file, an enterprise bean in an EJB .jar file, a Web component in a .war file, and a J2EE application client in a .jar file. An .ear file, for example, contains an .xml file for its deployment descriptor, and one or more EJB .jar and .war files. An EJB .jar contains its deployment descriptor and the .class files for the enterprise bean. The following table lists the file type of every element residing in a J2EE application.

TABLE 1-2 Files Used in a J2EE Application

Element

File Type

J2EE Application .ear
J2EE Application
Deployment Descriptor
.xml
Enterprise Bean ejb .jar
EJB Deployment Descriptor .xml
EJB Class .class
Remote Interface .class
Home Interface .class
Web Component .war
Web Component
Deployment Descriptor
.xml
JSP File .jsp
Servlet Class .class
GIF File .gif
HTML File .html
J2EE Application Client .jar
J2EE Application
Client Deployment Descriptor
.xml
Java Application .class

Development Phases of J2EE Applications

As a J2EE application evolves, it passes through these development phases:

In a large organization, each phase might be executed by different individuals or teams. This division of labor works because each of the earlier phases outputs a portable file that is the input for a subsequent phase. For example, in the Enterprise Bean Creation phase, a software developer delivers EJB .jar files. In the J2EE Application phase, another developer combines these EJB .jar files into a J2EE application and saves it in an .ear file. In the final phase, J2EE Application Deployment, a system administrator at the customer site uses the .ear file to install the J2EE application into a J2EE server. Figure 1-5 illustrates these last two phases.

The different phases are not always executed by different people. If you work for a small company, for example, or if you are protyping a sample application, you might peform the tasks in every phase.

FIGURE 1-5 J2EE Application Assembly and Deployment

The sections that follow summarize the development phases for J2EE applications. Because a J2EE application is not required to have every type of module, only one of the first three phases is required. The final two phases are necessary. Since this manual focuses on enterprise beans, it does not discuss the Web Component Creation phase. The next chapter in this manual, Getting Started, shows you how to build and deploy a sample J2EE application that contains an enterprise bean.

Enterprise Bean Creation

Person: software developer

Tasks:

Deliverable: the EJB .jar file containing the enterprise bean

Web Component Creation

Persons: Web designer (JavaServer Pages components), software developer (servlets)

Tasks:

Deliverable: the .war file containing the Web component

J2EE Application Client Creation

Person: software developer

Tasks:

Deliverable: the .jar file containing the J2EE application client

J2EE Application Assembly

Person: software developer

Tasks:

Deliverable: the .ear file containing the J2EE application

J2EE Application Deployment

Person: system administrator

Tasks:

Deliverable: an installed and configured J2EE application



Prev | Next

TOC | Index


Copyright © 2000 Sun Microsystems, Inc. All rights reserved.