10.12.2012 Views

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Packaging, Deploying, and Running the simplemessage Example<br />

678<br />

This command returns a JAR file named simplemessageClient.jar and then executes it.<br />

<strong>The</strong> output of the application client in the Output pane looks like this:<br />

Sending message: This is message 1<br />

Sending message: This is message 2<br />

Sending message: This is message 3<br />

To see if the bean received the messages,<br />

check /domains/domain1/logs/server.log.<br />

<strong>The</strong> output from the message-driven bean appears in the server log<br />

(domain-dir/logs/server.log), wrapped in logging information.<br />

MESSAGE BEAN: Message received: This is message 1<br />

MESSAGE BEAN: Message received: This is message 2<br />

MESSAGE BEAN: Message received: This is message 3<br />

<strong>The</strong> received messages often appear in a different order from the order in which they were sent.<br />

Undeploy the application after you finish running the client. To undeploy the application,<br />

follow these steps:<br />

1. Click the Services tab.<br />

2. Expand the Servers node.<br />

3. Expand the Application Server node.<br />

4. Expand the Applications node.<br />

5. Expand the Enterprise Applications node.<br />

6. Right-click simplemessage and choose Undeploy.<br />

To remove the generated files, right-click the simplemessage project and choose Clean.<br />

Building, Deploying, and Running the simplemessage<br />

Application Using Ant<br />

To create and package the application using Ant, use the default target for the build.xml file:<br />

ant<br />

This target packages the application client and the message-driven bean, then creates a file<br />

named simplemessage.ear in the dist directory.<br />

By using resource injection and annotations, you avoid having to create deployment descriptor<br />

files for the message-driven bean and application client. You need to use deployment<br />

descriptors only if you want to override the values specified in the annotated source files.<br />

To deploy the application and run the client using Ant, use the following command:<br />

<strong>The</strong> <strong>Java</strong> <strong>EE</strong> 5<strong>Tutorial</strong> • June 2010

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!