Home arrow Web Authoring arrow Page 2 - Building and Deploying an EAR
WEB AUTHORING

Building and Deploying an EAR


An EAR file provides a convenient way to bundle up all pieces of a J2EE application. This article, the first of two parts, will show you how to build one and explain its various pieces. It is excerpted from chapter 3 of the book JBoss at Work: A Practical Guide, written by Tom Marrs and Scott Davis (O'Reilly; ISBN: 0596007345). Copyright © 2006 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media.

Author Info:
By: O'Reilly Media
Rating: 4 stars4 stars4 stars4 stars4 stars / 12
July 05, 2007
TABLE OF CONTENTS:
  1. · Building and Deploying an EAR
  2. · Application.xml
  3. · Common JAR
  4. · Exploring the New Directory Structure

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Building and Deploying an EAR - Application.xml
(Page 2 of 4 )

Just as a WAR file contains a web.xml deployment descriptor, an EAR file contains a file named application.xml. It is essentially a packing list, telling the J2EE server exactly what files the EAR contains and where you can find the files relative to the root of the EAR. The EAR file’s META-INF directory stores application.xml.

Example 3-1 shows the JAW Motors application.xml file.

Example 3-1.  application.xml

<?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">
 <display-name>JBossAtWorkEAR</display-name>

 <module>
    
<web>
         <web-uri>webapp.war</web-uri>
         <context-root>jaw</context-root>
     </web>
  </module>

  <module>
     <java>common.jar</java>
  </module>

</application>

The elements in application.xml should be pretty self-explanatory. We are telling the application server the name of each JAR and what function it serves.

Notice that Web modules allow you to specify one other value—the<context-root>. Recall from the previous chapter that the context root is your web site’s URL. If you deploy a simple WAR file, the name of the WAR will be used as the URL. When your WAR file is deployed inside an EAR, this element allows you to override the physical name of the WAR and use whatever URL you’d like.

Although not shown in this example,<security-role>is another important element in application.xml.The<security-role>element describes (what else?) the security roles used throughout a J2EE application for both web and EJB components. Defining security roles in application.xml provides a single place to set up J2EE declarative security without duplicating it in web.xml and ejb-jar.xml. The Security chapter describes<security-role>in greater detail.


blog comments powered by Disqus
WEB AUTHORING ARTICLES

- Top WordPress Plugins for Social Media
- How to Install WordPress on WAMPP
- More of the Best Wordpress Plugins for Comme...
- Top Wordpress Plugins to Fight Spam
- More of the top Drupal modules for SEO
- Top Drupal Modules for SEO
- More Top Wordpress Plugins for SEO
- Website Optimization Tips
- Backup and Restore a Drupal Website and Data...
- 5 Best Web Font Services
- Web Font Embedding Services
- Joomla Site Administration
- Create PHP Pages that Use WordPress Templates
- Top Joomla Extensions for Social Networking
- Drupal Modules for Site Navigation

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 2 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials