Building, Packaging, Deploying, and Running the Application

To build the Duke's Bank application, you must have installed the tutorial bundle as described in About the Examples (page xxxvi). When you install the bundle, the Duke's Bank application files are located in the <INSTALL>/javaee5tutorial/examples/dukesbank/ directory. This directory contains the configuration files for creating the EAR, dukesbank.ear. The EAR consists of the following three modules:

After you build the source code, all the submodules will be built into their respective module packages, and the resulting EAR file will reside in the <INSTALL>/javaee5tutorial/examples/dukesbank/dist/ directory.

Setting Up the Servers

Before you can package, deploy, and run the example, you must first set up the JavaDB database server with customer and account data, and you must add some resources to the Application Server.

Starting the Application Server

Before you can start this tutorial, the Application Server must be running. For information on starting the Application Server, see Starting and Stopping the Application Server (page 27).

Creating the Bank Database

In Duke's Bank the database tables will be created and populated before deploying the application. This happens automatically when running the deploy task. You can manually reset the database to its original state by following these steps:

  1. In a terminal window or command prompt, go to the <INSTALL>/javaee5tutorial/examples/dukesbank/ directory.
  2. Execute the command ant create-tables. This task executes the SQL commands contained in <INSTALL>/javaee5tutorial/examples/common/sql/javadb/tutorial.sql. The SQL commands delete any existing tables, create new tables, and insert the initial data in the tables.

Adding Users and Groups to the File Realm

To enable the Application Server to determine which users can access enterprise bean methods and resources in the web client, add users and groups to the server's file security realm using the Admin Console following the procedures described in Managing Users (page 1121). Add the users and groups listed in Table 38-3.

Table 38-3 Duke's Bank Users and Groups 

Building the Duke's Bank Application

To compile and package the enterprise beans, application client, and web client into dukesbank.ear, go to the <INSTALL>/javaee5tutorial/examples/dukesbank/ directory of the tutorial distribution and execute the command:


Deploying the Application

Run the following command to deploy dukesbank.ear:

ant deploy 

This task calls the create-tables task to initialize the database tables.