EAR Packaging
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
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 web components (war)
-
One or more wars which contain the web components of the J2EE
application. When the wars are packaged in a J2EE application,
you don't have to package bean classes in the
WEB-INF/lib directory, this is due to the class loader
hierarchy.
Details about this class loader hierarchy should be found at
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
To build an ear file for a J2EE application, the ejb-jars and the wars that you want to package in your J2EE application
must have been built and the XML deployment descriptor (application.xml) should have been written.
Then, the ear file (<j2ee-application>.ear
) is built, using the jar command:
cd <your_j2ee_application_directory>
jar cvf <j2ee-application>.ear *