background image

Building the clientmdbentity Example

<< Creating Resources | Undeploy the Example Application >>
<< Creating Resources | Undeploy the Example Application >>

Building the clientmdbentity Example

Building, Deploying, and Running the
clientmdbentity
Example Using NetBeans IDE
To build, deploy, and run the application using NetBeans IDE, do the following:
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
, if it is not already running.
3. In NetBeans IDE, choose Open Project from the File menu.
4. In the Open Project dialog, navigate to tut-install/javaeetutorial5/examples/jms/.
5. Select the clientmdbentity folder.
6. Select the Open as Main Project check box and the Open Required Projects check box.
7. Click Open Project Folder.
8. Right-click the clientmdbentity project and choose Build Project. This task 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
9. Right-click the project and choose Deploy Project.
10. Right-click the project and choose Run Project.
This command returns a JAR file named clientmdbentityClient.jar and then executes it.
The output of the application client in the Output pane looks something like this:
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:
Employee ID: 26
A Java EE Application That Uses the JMS API with an Entity
Chapter 32 · Java EE Examples Using the JMS API
975