Java
  Home arrow Java arrow Page 10 - 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
     
     
    Iron Speed
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Introduction to Enterprise JavaBeans - Using the J2EE Reference Implementation
    (Page 10 of 14 )

    In this section, you will look at how to deploy an EJB in the J2EE Reference Implementation (RI) and how to run the simple application client.

    Configuring J2EE RI

    On Day 2 you were asked to install and configure the J2EE RI available, free of charge, from Sun Microsystems (at http://java.sun.com/j2ee) and build a sample database for the exercises in this book. If you have not already done so go back to Day 2 and follow the instructions for installing the J2EE RI and building the Agency case study database.


    Note - As discussed on Day 2, before running any of the tools described in this section, you will need to set the J2EE_HOME environment variable to the location on your hard drive where you installed the J2EE reference implementation. You should also add the bin directory below J2EE_HOME to your executable search path (%PATH% under Windows or $PATH under Solaris/Linux) so that you can run J2EE tools and batch files from the command line. You should place the J2EE bin directory at the front of your PATH setting to avoid conflicts with system tools with the same names as the J2EE tools. You should also copy the code in the CaseStudy directory on the accompanying Web site onto your local hard disk, because commands you will run today require write access to the working directory.


    There are two approaches to building and deploying a J2EE component or application using J2EE RI:

    • You can use the deploytool provided with the J2EE SDK.

    • You can use the asant utility supplied with the J2EE SDK (this is a modified version of the popular Apache Ant utility from http://jakarta.apache.org/ant). The J2EE tutorial examples for J2EE SDK 1.4 are built and deployed using asant build files and asant build files are supplied for all the examples used throughout this book.

    As a newcomer to J2EE, you will find it informative to use the GUI interface of deploytool for building and configuring the EAR and WAR files used to hold your EJBs, applications, and web components. As you gain more experience, you might find the speed of the asant command-line interface to be preferable. You will also find asant build files useful for scripting automated testing procedures.

    The disadvantage of using asant is that you will have to write the build files yourself; not to mention hand crafting all the deployment descriptors. Many developers use deploytool once to generate the basic deployment descriptors and then save these descriptors to disk for use with asant build files. That is how most of the examples for this book were developed.

    This section will show how to build and deploy J2EE components using deploytool before looking at the asant build files used for the Agency case study example. The directory structure for the book's example code was discussed on Day 2, but as a quick reminder, these are the subdirectories under the exercise directory for Day 4:

    • build—A temporary directory used by the asant build files (created when needed)

    • classes—The compiled class files

    • dd—The deployment descriptor files used by the asant build files

    • j2ee-ri—Repository for files manipulated by deploytool

    • src—The Java source files

    • JSP—The HTML and JavaServer Pages source files

    Remember to make sure you are running the J2EE RI server and PointBase database servers and have created the Agency database before starting this exercise.

    Opening the Case Study EAR File

    Now you are ready to run the deploytool found in the bin directory under the J2EE_HOME directory. Start a command line window in the Day04/exercise directory and enter the command:

    deploytool

    You will be presented with a graphic interface for building J2EE components. If you have not set your PATH to include the bin directory under J2EE home you will have to provide the full pathname for deploytool. Windows users can use the Start, Programs, Sun Microsystems, J2EE 1.4 SDK, Deploytool menu or run

    %J2EE_HOME%\bin\deploytool

    Solaris and Linux users should enter

    $J2EE_HOME/bin/deploytool

    In deploytool, use the File, Open menu to open the supplied agency enterprise archive (EAR) file in Day04/exercise/j2ee-ri/agency.ear. The agency application will now be displayed in the list of applications, as shown in Figure 4.2.

    bond

    Figure 4.2
    The Agency application loaded by deploytool.

    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

    Iron Speed
     
    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 3 hosted by Hostway