IBM


13.2.2 Working with deployment descriptors

Information describing a J2EE application and how to deploy it into a J2EE container is stored in XML files called deployment descriptors. An EAR file normally contains multiple deployment descriptors, depending on the modules it contains. Figure 13-6 shows a schematic overview of a J2EE EAR file. In this figure, the various deployment descriptors are designated with DD after their name.

Figure 13-6 J2EE EAR file structure

The deployment descriptor of the EAR file itself is stored in the META-INF directory in the root of the EAR and is called application.xml. It contains information about the modules that make up the application.

The deployment descriptors for each module are stored in the META-INF directory of the module and are called web.xml (for Web modules), ejb-jar.xml (for EJB modules), ra.xml (for resource adapter modules), and application-client.xml (for application client modules). These files describe the contents of a module and allow the J2EE container to configure things like servlet mappings, JNDI names, and so forth.

Classpath information specifying which other modules and utility JARs are needed for a particular module to run is stored in the manifest.mf file also in the META-INF directory of the modules.

In addition to the standard J2EE deployment descriptors, EAR files produced by the Application Server Toolkit can also include additional WebSphere-specific information used when deploying applications to WebSphere environments. This supplemental information is stored in files called ibm-xxx-xxx-xxx.xmi, also in the META-INF directory of the respective modules. Examples of information in the IBM-specific files are IBM extensions like servlet reloading and EJB access intents.

WAS V6.0 and V6.1 can also store deployment-related information (such as data sources, class loader settings, and so on) as part of an Enhanced EAR file. This information is stored in an ibmconfig subdirectory of the EAR file's META-INF directory.

The Application Server Toolkit has easy-to-use editors for working with all deployment descriptors. The information that goes into the different files are shown on one page in the GUI, eliminating the need to be concerned about what information is put into what file. However, if you are interested, you can click the Source tab of the deployment descriptor editor to see the text version of what is stored in that descriptor. For example, if you open the EJB deployment descriptor, you will see settings that are stored across multiple deployment descriptors for the EJB module, including:

The EJB deployment descriptor, ejb-jar.xml

The extensions deployment descriptor, ibm-ejb-jar-ext.xmi

The bindings file, ibm-ejb-jar-bnd.xmi files

The access intent settings, ibm-ejb-access-bean.xmi

To work with a deployment descriptor...

1. Open the J2EE perspective.

2. In the J2EE Project Explorer view, expand the project category (Enterprise Applications, EJB Projects, Dynamic Web Projects, and so on), and then expand the module you want to work with.

3. Double-click the deployment descriptor to open the editor for it. The deployment descriptor is module name with a version number in front. The version number refers to the J2EE specification level for the module.

Figure 13-7 EJB deployment descriptor

4. Figure 13-8 shows the deployment descriptor for the PlantsByWebSphere EJB module open with the deployment descriptor editor.

Figure 13-8 EJB deployment descriptor

The editor shows you information stored in all the relevant deployment descriptor files on the appropriate tabs. The descriptor files are kept in the META-INF directory of the module you are editing.

When you have made changes to a deployment descriptor, save it by pressing Ctrl+S and then close it.


Redbooks ibm.com/redbooks

Next