background image

Running the Example Using Ant

<< Undeploy the Example Application | Removing the Generated Files >>
<< Undeploy the Example Application | Removing the Generated Files >>

Running the Example Using Ant

Building, Deploying, and Running the
clientmdbentity
Example Using Ant
To create and package the application using Ant, perform these steps:
1. Start the Application Server, if it is not already running.
2. Start the database server as described in
"Starting and Stopping the Java DB Database
Server" on page 69
.
3. Go to the following directory:
tut-install/javaeetutorial5/examples/jms/clientmdbentity/
4. To compile the source files and package the application, use the following command:
ant
The ant command creates the following:
An application client JAR file that contains the client class and listener class files, along with
a manifest file that specifies the main class
An EJB JAR file that contains the message-driven beans and the entity class, along with the
persistence.xml
file
An application EAR file that contains the two JAR files along with an application.xml file
To deploy the application and run the client, use the following command:
ant run
Ignore the message that states that the application is deployed at a URL.
The program output in the terminal window looks something like this:
running application client container.
PUBLISHER: Setting hire ID to 25, name Gertrude Bourbon, position Senior Programmer
PUBLISHER: Setting hire ID to 26, name Jack Verdon, position Manager
PUBLISHER: Setting hire ID to 27, name Fred Tudor, position Manager
PUBLISHER: Setting hire ID to 28, name Fred Martin, position Programmer
PUBLISHER: Setting hire ID to 29, name Mary Stuart, position Manager
Waiting for 5 message(s)
New hire event processed:
Employee ID: 25
Name: Gertrude Bourbon
Equipment: Laptop
Office number: 183
Waiting for 4 message(s)
New hire event processed:
A Java EE Application That Uses the JMS API with an Entity
Chapter 32 · Java EE Examples Using the JMS API
977