EAR Packaging
Target Audience and Content
The target audience for this guide is the Application Assembler, i.e. the
person in charge of combining one or more J2EE components (ejb-jars
and/or wars) to create a J2EE application. It describes how the J2EE
components should be packaged to create a J2EE application.
The content of this guide is the following:
- Target Audience and Content
- Principles
Principles
J2EE applications are packaged for deployment in a standard Java
programming language Archive file called an ear file (Enterprise
ARchive). This file can contain the following:
- The web components (war)
- One or more wars which contain the web components of the J2EE
application. Due to the class loader hierarchy, when the wars are
packaged in a J2EE application, it is not necessary to package bean
classes in the WEB-INF/lib directory.
Details about this class loader hierarchy are described in JOnAS class loader hierarchy.
- The beans (ejb-jar)
- One or more ejb-jars, which contain the beans of the J2EE
application.
- The libraries (jar)
- One or more jars which contain the libraries (tag libraries and any
utility libraries) used for the J2EE application.
- The J2EE deployment descriptor
- The standard xml deployment descriptor in the format defined in the
J2EE 1.3 specification. See
$JONAS_ROOT/xml/application_1_3.dtd. This deployment
descriptor must be stored with the name
META-INF/application.xml in the ear file.
Example
Before building an ear file for a J2EE application, the ejb-jars and the
wars that will be packaged in the J2EE application must be built and the XML
deployment descriptor (application.xml) must be written.
Then, the ear file (<j2ee-application>.ear
) can be
built using the jar command:
cd <your_j2ee_application_directory>
jar cvf <j2ee-application>.ear *