2.3.3 J2EE applications and J2EE component

One or more J2EE components configure the J2EE application. This subsection describes the J2EE applications and J2EE components.

Organization of this subsection
(1) Relation between J2EE application and J2EE components
(2) Structure of a J2EE application
(3) Developing J2EE application and J2EE components

(1) Relation between J2EE application and J2EE components

The user application programs such as servlets, JSPs, and Enterprise Beans configure the J2EE application. The J2EE application runs in the J2EE container.

The servlets, JSPs, and Enterprise Beans configuring the J2EE application are called J2EE components.

The following figure shows the relation between the J2EE application and J2EE components:

Figure 2-3 Relation between the J2EE application and J2EE components

[Figure]

(2) Structure of a J2EE application

A J2EE application has a structure with three layers. The following figure shows the structure of a J2EE application:

Figure 2-4 Structure of a J2EE application

[Figure]

The smallest units of the J2EE application are the files in layer 3 (files enclosed with a dotted line in the figure). Layer 3 includes files such as the class files and JSP files.

The files in layer 2 are the packages of the files in layer 3. For example, in the above figure, the EJB-JAR file in layer 2 is formed by packaging an Enterprise Bean and a DD (ejb-jar.xml) that belong in layer 3.

Furthermore, the respective files packaged in layer 2 form the J2EE application in layer 1.

The packaged files of layer 1 and layer 2 are as follows. The numbers in the figure correspond to the numbers in the following explanation:

Reference note
The file formats and DTDs of the DDs are predetermined by the respective layers.
A DD indicates the file wherein the definition information when deploying applications in the operating environment is coded. For an EJB-JAR file, the DD is ejb-jar.xml, for a Web application, the DD is web.xml, and for a J2EE application, the DD is application.xml.
Note that for using annotations in an Enterprise Bean, ejb-jar.xml is not required.
(a) J2EE application

Multiple EJB-JARs, Web applications, library JARs, and a single DD (application.xml) configure a J2EE application.

The J2EE application that can be executed on the J2EE server is in archive format and in exploded archive format.

(b) EJB-JAR

An EJB-JAR is packaged in an EJB-JAR file format. Multiple Enterprise Beans and a single DD (ejb-jar.xml) configure an EJB-JAR. Note that when using annotations in Enterprise Bean, a DD (ejb-jar.xml) is not required.

(c) Web application

A Web application is packaged in a WAR file format. Multiple servlets, JSPs, HTML documents, and a single DD (web.xml) configure the Web application.

(d) Library JAR

A library JAR is packaged in a JAR file format. Multiple common libraries configure the Library JAR. A common library is a library where you can use J2EE components in the J2EE application in common. Apart from the files defined under the <module> tag of the DD (application.xml) in the J2EE application, the JAR files with the extension in lower case (.jar) are considered as the library JAR.

(3) Developing J2EE application and J2EE components

In a J2EE application, to use the functionality as an execution platform provided by Application Server, you must execute the application according to the functionality used. Furthermore, Application Server provides a Developer as a product for developing the J2EE application and J2EE components.

For details about how to develop the J2EE applications and J2EE components, see the uCosminexus Application Server Application Development Guide.