RosterApp Deployment Descriptors
There are several deployment descriptors created in the process of deploying the Roster application: the RosterApp.ear with all the deployment descriptors and the class file that make up the ejb-jar and war files.
The RosterApp.ear package contained three deployment descriptorsstandard J2EE, application.xml, and vendor-specific sun-j2ee-ri.xml. The application.xml descriptor contains information about the content of the RosterApp.ear file, including the ejb-jar component, the Web component, and the root context for the application to be used during deployment.
<application> <display-name>RosterApp</display-name> <description>Application description</description> <module> <web> <web-uri>war-ic.war</web-uri> <context-root>/RosterContextRoot</context-root> </web> </module> <module> <java>app-client-ic.jar</java> </module> <module> <ejb>ejb-jar-ic.jar</ejb> </module> </application>
The sun-j2ee-ri.xml deployment descriptor file consists of information targeted to a specific vendor's application serverour example is specific to Sun's Reference Implementation Server. In general, this deployment descriptor deals with the high-level reference to JNDI name mapping for both Web and EJB components. Applicable lines are highlighted in the code fragment that follows. All information was derived during the deployment process. Also note that this file has no component-specific information, but most assembly-specific information is handled differently by different application servers.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE j2ee-ri-specific-information PUBLIC '-//Sun Microsystems Inc.//DTD J2EE Reference Implementation 1.3//EN' 'http://local-host: 8000/sun-j2ee-ri_1_3.dtd'> <j2ee-ri-specific-information> <server-name></server-name> <rolemapping /> <web> <module-name>war-ic.war</module-name> <context-root>/RosterContextRoot</context-root> <resource-ref> <res-ref-name>jms/TheQueFactory</res-ref-name> <jndi-name>MyQueFactory</jndi-name> <default-resource-principal> <name>j2ee</name> <password>j2ee</password> </default-resource-principal> </resource-ref> <resource-env-ref> <resource-env-ref-name>jms/TheQue</resource-env-ref-name> <jndi-name>MyQue</jndi-name> </resource-env-ref> </web> <enterprise-beans> <module-name>ejb-jar-ic.jar</module-name> <unique-id>0</unique-id> <ejb> <ejb-name>RosterMDB</ejb-name> <jndi-name>MyQue</jndi-name> <ior-security-config> <transport-config> <integrity>supported</integrity> <confidentiality>supported</confidentiality> <establish-trust-in-target>supported</establish-trust-in-tar-get> <establish-trust-in-client>supported</establish-trust-in-cli-ent> </transport-config> <as-context> <auth-method>username_password</auth-method> <realm>default</realm> <required>true</required> </as-context> <sas-context> <caller-propagation>supported</caller-propagation> </sas-context> </ior-security-config> <principal> <name></name> </principal> <resource-ref> <res-ref-name>jdbc/JCampDS</res-ref-name> <jndi-name>jdbc/Cloudscape</jndi-name> <default-resource-principal> <name>j2ee</name> <password>j2ee</password> </default-resource-principal> </resource-ref> <resource-ref> <res-ref-name>jms/TheQueFactory</res-ref-name> <jndi-name>MyQueFactory</jndi-name> </resource-ref> <resource-env-ref> <resource-env-ref-name>jms/TheQue</resource-env-ref-name> <jndi-name>MyQue</jndi-name> </resource-env-ref> <gen-classes /> <mdb-connection-factory>MyQueFactory</mdb-connection-factory> </ejb> </enterprise-beans> </j2ee-ri-specific-information>
The ejb-ic.jar file had one deployment descriptor file: ejb-jar.xml. This deployment descriptor is specific to the EJB component; it maps names to a specific class and defines the EJB type, as we discussed previously.
The war-ic.war file contained one deployment descriptorweb.xml. This deployment descriptor is read by the Web container at runtime and contains information on the Web component, which we looked at earlier during the application packaging process.