background image

Running the simplemessage Application

<< Creating the Administered Objects | Removing the Administered Objects >>
<< Creating the Administered Objects | Removing the Administered Objects >>

Running the simplemessage Application

This command returns a JAR file named simplemessageClient.jar and then executes it.
The output of the application client in the Output pane looks like this:
Sending message: This is message 1
Sending message: This is message 2
Sending message: This is message 3
To see if the bean received the messages,
check <install_dir>/domains/domain1/logs/server.log.
The output from the message-driven bean appears in the server log
(domain-dir/logs/server.log), wrapped in logging information.
MESSAGE BEAN: Message received: This is message 1
MESSAGE BEAN: Message received: This is message 2
MESSAGE BEAN: Message received: This is message 3
The received messages often appear in a different order from the order in which they were sent.
Undeploy the application after you finish running the client. To undeploy the application,
follow these steps:
1. Click the Runtime tab.
2. Expand the Servers node.
3. Expand the Sun Java System Application Server node.
4. Expand the Applications node.
5. Expand the Enterprise Applications node.
6. Right-click simplemessage and choose Undeploy.
To remove the generated files, right-click the simplemessage project and choose Clean Project.
Building, Deploying, and Running the simplemessage
Application Using Ant
To create and package the application using Ant, use the default target for the build.xml file:
ant
This target packages the application client and the message-driven bean, then creates a file
named simplemessage.ear in the dist directory.
By using resource injection and annotations, you avoid having to create deployment descriptor
files for the message-driven bean and application client. You need to use deployment
descriptors only if you want to override the values specified in the annotated source files.
To deploy the application and run the client using Ant, use the following command:
Packaging, Deploying, and Running the simplemessage Example
The Java EE 5 Tutorial · September 2007
680