O'Reilly logo

Java Enterprise in a Nutshell, Third Edition by William Crawford, Jim Farley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Application Archives (application .xml)

Enterprise application archives (ears) contain collections of component archives (web, EJB, and so on) that make up an application. An application.xml deployment descriptor is used to declare and configure the component archives, as well as declare applicationwide security roles. Figure A-14 shows the structure of the application deployment descriptor.

Example A-14 shows a sample application deployment descriptor, annotated with descriptive comments. Note that this example uses the application descriptor schema from the J2EE 1.4 specification, referencing the schema from the default location on the http://java.sun.com server. To use the J2EE 1.3 application descriptor DTD, you would need to replace the application element tag and its schema reference with the following empty tag and DOCTYPE entry:

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

Figure A-14. Application archive deployment descriptor overview

Example A-14. Annotated application deployment descriptor

<?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"> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required