Java
  Home arrow Java arrow Page 7 - Introduction to Enterprise JavaBeans
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

Introduction to Enterprise JavaBeans
By: Martin Bond
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 38
    2004-06-21

    Table of Contents:
  • Introduction to Enterprise JavaBeans
  • Types of EJB and Common Uses of EJBs
  • What's in an EJB?
  • The Home Interface
  • Implementing the Home Interface
  • Verifying an EJB
  • The EJB-JAR File
  • How Do I Deploy an EJB?
  • Disposing of the EJB
  • Using the J2EE Reference Implementation
  • Examining the Case Study Application
  • Verifying the Case Study Application
  • Managing J2EE RI Applications
  • Troubleshooting the Case Study Application

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    Dell PowerEdge Servers

    Introduction to Enterprise JavaBeans - The EJB-JAR File
    (Page 7 of 14 )

    All of the EJB classes and the deployment descriptor should be bundled up in a JAR file. The deployment descriptor is stored in a META-INF directory (the same location as the JAR manifest file) and must be named ejb-jar.xml. If there are multiple EJBs packaged in the same JAR file, the deployment descriptor will have multiple EJB definitions in it. The JAR file is then termed an EJB-JAR file to denote its payload. The JAR file itself can be called anything (but obviously a name appropriate to the application makes most sense) and conventionally has a .jar file extension.

    The EJB-JAR file can also contain any extra resources required by the EJB, such as platform-specific configuration information that does not fit in the standard deployment descriptor.

    Typical contents of a platform specific deployment descriptor are

    • The JNDI name the EJB must be deployed under Mappings between resources referenced in the J2EE components such as EJBs and the actual resources within the J2EE server

    An EJB-JAR file can store more than one platform-specific deployment descriptor file, enabling it to be used with different J2EE implementations. Although the EJB-JAR file is now complete, it must form part of an application to serve a useful purpose. J2EE defines that enterprise applications can be built from components (Web, EJB, and Client Application components). Therefore, a second JAR file is used to bundle these J2EE components into a complete J2EE Application, this is called the Enterprise Archive file.

    The Enterprise Archive File

    The Enterprise Archive (EAR) file contains a number of J2EE components comprising an application and yet another deployment descriptor. This descriptor includes a description of the application, which components it uses, how those components relate to each other, and which specific resources they use. This is the information provided by the Application Assembler and Deployer.

    The application deployment descriptor is also an XML document, called application.xml, and it is stored in the META-INF directory of the Enterprise Archive (which although a JAR file the Enterprise Archive typically has a filename extension of .ear not .jar). Listing 4.6 shows the application.xml descriptor for the Agency application.

    Listing 4.6 Agency Bean EJB Deployment Descriptor

    <?xml version="1.0" encoding="UTF-8"?>
    <application version="1.4" 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">
     <description>Application description</description>
     <display-name>agency</display-name>
     <module>
      <ejb>agency-session-ejb.jar</ejb>
     </module>
     <module>
      <web>
       <web-uri>webagency.war</web-uri>
       <context-root>/webagency</context-root>
      </web>
     </module>
    </application>

    The application.xml file just lists the modules that form the enterprise application, in this case the single Agency EJB contained in agency-session-ejb.jar.

    An EAR file may also contain one or more platform-specific deployment descriptors for the application enabling it to be used with different J2EE implementations.

    This chapter is from Teach Yourself J2EE in 21 Days, second edition, by Martin Bond et. al. (Sams, 2004, ISBN: 0-672-32558-6). Check it out at your favorite bookstore today. Buy this book now.

    More Java Articles
    More By Martin Bond


     

       

    JAVA ARTICLES

    - The Spring Framework: Understanding IoC
    - Introducing the Spring Framework
    - Java Classes
    - Completing the Syntactic Comparison of Java ...
    - Syntactic Comparison of Java and C/C++
    - Java Statements
    - Conditionals, Expressions and Other Java Ope...
    - Java Operators
    - Primitive Data Types and Basic Language Rule...
    - Java and Object-Oriented Programming
    - Java Beginning Programming
    - Gaming Development Setup
    - Using RPC-Style Web Services with J2EE
    - Integrating XML with J2EE
    - Taming Tiger: Concurrent Collections

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway