Topics

 

 

Introduction

To top of page

J2EE application assemblers assemble J2EE Modules into a J2EE Application. Application Assemblers can pick off-the-shelf modules and use them in their applications simply by modifying the deployment descriptors or by providing alternative descriptors.

Some application servers require an EAR "wrapper" around the EJB-JAR, WAR, and other JAR archives for deployment, which means that the J2EE application component provider may also need to assemble an EAR for testing.

Detailed steps assembling a J2EE Application are provided by the J2EE specification, section J2EE.8.3 Application Assembly. The following is a summarized extract of this guidance.

 

Assembling a J2EE Application

To top of page

Assembling a J2EE Application involves the following steps:

  1. Select the J2EE Modules that will be used by the application.
  2. Create an application directory structure.
  3. Reconcile J2EE Module deployment descriptors.

    • Edit J2EE Module deployment descriptors to link internally satisfied dependencies and eliminate redundant security role names.
    • Define transactions, security roles, method permissions, etc.
    • Optionally use the alt-dd element to specify an alternative deployment descriptor while preserving the original deployment descriptor.
    • Assign a context root for each web module included in the J2EE application.
    • Ensure component dependencies are correctly described.
    • Ensure there is only one version of each class in the application.

  4. Create an XML deployment descriptor for the application named "application.xml".
  5. Package the application.
    a. Place the J2EE modules in the appropriate directories. Place the deployment descriptor in META-INF/application.xml.
    b. Package into a ".EAR" file.

 

Adding/Removing Modules

To top of page

J2EE modules may be added to an application before
deployment, using the following steps:

  1. Decide on a location in the application package for the new module. Optionally
    create new directories in the application package hierarchy.
  2. Copy the new J2EE Modules to the desired location in the application package.
  3. Edit the deployment descriptors for the J2EE Modules to link the dependencies
    which are internally satisfied by the J2EE Modules included in the application.
  4. Edit the J2EE Application deployment descriptor as required.

Similarly a module can be removed by removing the module from the application package hierarchy and editing the deployment descriptors to remove inconsistencies.

 

Validating the Application

To top of page

It is a good idea to valid the contents of the archive before attempting deployment, as obscure errors, especially on the application server side, may result in obscure or non-existent error messages. For example, confirm there is at least one module defined in the EAR

The EAR can also be validated using a J2EE verifier tool that is provided with the J2EE SDK. It makes sure that the EAR is internally consistent and well-formed. For example, it makes sure that the module and application archives are consistent with the standard specifications (J2EE, Servlet, and EJB).



Rational Unified Process  

2003.06.13