Chapter 15. Enterprise Applications (EARs) [DRAFT (1.0)]

Table of Contents

15.1. Creating an Enterprise Application EAR
15.1.1. application.xml Format
15.2. The Enterprise Application Geronimo Deployment Plan
15.3. Structure of the Deployment Plan
15.3.1. Customizing the Application Class Path
15.3.2. Configuring Application Modules
15.3.3. Application-Wide Security Mapping
15.3.4. Adding Application-Scoped Services

Each enterprise application is made up of a number of other J2EE modules (commonly packaged ionto an EAR file). When grouped together into one application, modules can:

Geronimo supports J2EE 1.4 applications, with backward compatibility to previous spec revisions. In addition to the common application features, a Geronimo application can:

Deploying Enterprise Applications to Geronimo typically involves several steps:

  1. Prepare the Web application WARs, EJB JARs, J2EE Connector RARs, application client JARs, and any third party JARs that will go into the enterprise application.

  2. Create the standard application.xml deployment descriptor

  3. Create a Geronimo-specific geronimo-application.xml deployment plan

  4. Package the enterprise application and deployment descriptors into an EAR file, or a directory tree laid out like an EAR

  5. Use the deployment tool described in Section 10.4, “The Deploy Tool” to deploy the EAR into the server

The process of developing enterprise applications and the standard application.xml deployment descriptor should be familiar already. After a brief review of what Geronimo expects from an EAR, this chapter focuses mainly on the contents of the Geronimo geronimo-application.xml deployment plan. This plan may be packaged within the application EAR, or provided as a separate file to the deployment tool.

15.1. Creating an Enterprise Application EAR

Geronimo doesn't have any special requirements on EAR files -- any EAR produced according to the standard J2EE process should work in Geronimo. However, there are a couple points to note:

  • Geronimo requires that every EAR file has a standard META-INF/application.xml deployment descriptor. This may be configured for J2EE 1.2, J2EE 1.3, or J2EE 1.4, and should follow the appropriate XML format (see below).

  • Any external libraries can be placed in the Geronimo server repository and referenced with dependency elements in the Geronimo deployment plan (see Section 15.3.1, “Customizing the Application Class Path”). Any changes to the EAR class path will be visible to web applications, EJBs, and J2EE Connectors within the EAR.

15.1.1. application.xml Format

Geronimo expects the META-INF/application.xml file to obey one of the following standard formats:

J2EE 1.2

Defined by the DTD at http://java.sun.com/j2ee/dtds/application_1_2.dtd, a J2EE 1.2 application deployment descriptor looks like this:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE application PUBLIC
    "-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN"
    "http://java.sun.com/j2ee/dtds/application_1_2.dtd">

<application>
  ...
</application>
J2EE 1.3

Defined by the DTD at http://java.sun.com/dtd/application_1_3.dtd, a J2EE 1.3 application deployment descriptor looks like this:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE application PUBLIC
    "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
    "http://java.sun.com/dtd/application_1_3.dtd">

<application>
  ...
</application>
J2EE 1.4

Defined by the XML schema at http://java.sun.com/xml/ns/j2ee/application_1_4.xsd, a J2EE 1.4 application deployment descriptor looks like this:

<?xml version="1.0" encoding="UTF-8"?>

<application xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
         http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"
        version="1.4">
  ...
</application>