Home arrow Web Authoring arrow Page 3 - 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 - Common JAR
(Page 3 of 4 )

In the previous chapter, we created a CarBean POJO to hold the various attributes of a car. We stored it in the WAR file because, well, you didn’t have any other choice at that time. We should now reconsider the storage location for the CarBeanto maximize its reuse.

By the end of this book, we will pull cars out of a database in the persistence tier, and hand them to objects in the business tier, which ultimately will pass them up to the presentation tier. An object that is shared across tiers is a perfect candidate for the Common JAR.

In addition to custom domain objects, the Common JAR is a great location to store common libraries such as Log4J or JDOM. While both WARs and EJB JARs have lib directories, they are best used for tier-specific libraries. For example, the JSTL JARs belong in the WAR—they have no other purpose than to support the creation of web pages. On the other hand, logging is something that happens throughout the codebase—it really belongs in a common JAR.

Let’s factor ourCarBean out of the WAR and into the Common JAR. In addition to moving directories, we’re going to rename it to better describe its purpose in the application.

The suffix “Bean” is a bit overloaded: it includes JavaBeans, Enterprise Java Beans, Session Beans, Message-Driven Beans, JMX MBeans, and the list goes on. The design pattern that best describes theCarBean’s function is a Data Transfer Object (DTO), so when we move the bean, we’ll also rename itCarDTO. The source code will remain the same, but the name will give us a better idea about the true purpose of the class.


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 11 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials