Java Reference
In-Depth Information
Java EE applications
In the simplest sense, Java EE EAR s can be thought of as bigger versions of Java SE
JAR s. EAR s are in zip format, like JAR s, but rather than containing Java classes, they
contain enterprise modules such as WAR s and EJB JAR s. One other key difference
between EAR s and JAR s is that an EAR contains an application descriptor called META-
INF /application.xml rather than a standard manifest.
Listing 4.1
A simple application.xml
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns=""
<display-name>My EAR Application</display-name>
<description>An example EAR</description>
for WAR
Folder for
utility JARs
The application XML descriptor in listing 4.1 shows how a Java EE EAR provides a
complete list of the content of the application (the WAR s, EJB s, and library JAR s that
make up the application) and it can also contain security metadata. While it's possi-
ble for the application.xml to reference a module that isn't contained directly within
the EAR , this is an extremely uncommon practice. Often the application.xml is used
to do no more than restate the contents of the EAR and to provide context roots for
any web modules.
Improvements to the EAR model
Starting with Java EE 5, the application.xml descriptor became optional, only being
specified if you needed to override any defaults. This helps to reduce the duplication
typically present in the EAR metadata as modules inside an EAR no longer need to
be listed in application.xml as well.
Search WWH ::

Custom Search