Download
FAQ
History
PrevHomeNext API
Search
Feedback
Divider

Deploying and Running SimpleMessageApp

To deploy and run this example, go to the <INSTALL>/j2eetutorial14/examples/ejb/simplemessage directory.

Creating the Administered Objects

This example requires the following:

If you have run the simple JMS examples in Chapter 33 and have not deleted the resources, you already have these resources and do not need to perform these steps.

To start the Admin Console, follow the instructions in Starting the Admin Console.

To create the connection factory, perform the following steps:

  1. In the tree component, expand the Java Message Service node.
  2. Select the Connection Factories node.
  3. On the JMS Connection Factories page, click New. The Create JMS Connection Factory page appears.
  4. In the JNDI Name field, type jms/QueueConnectionFactory.
  5. Choose javax.jms.QueueConnectionFactory from the Type combo box.
  6. Select the Enabled checkbox.
  7. Click OK.

To create the physical destination, perform the following steps:

  1. In the tree component, select the Physical Destinations node.
  2. On the Physical Destinations page, click New. The Create Physical Destination page appears.
  3. In the Physical Destination Name field, type PhysicalQueue.
  4. Choose queue from the Type combo box.
  5. Click OK.

To create the destination resource and link it to the physical destination, perform the following steps:

  1. In the tree component, expand Destination Resources.
  2. On the JMS Destination Resources page, click New. The Create JMS Destination Resource page appears.
  3. In the JNDI Name field, type jms/Queue.
  4. Choose javax.jms.Queue from the Type combo box.
  5. Select the Enabled checkbox.
  6. Under Additional Properties, click Add.
  7. Type Name in the Name field.
  8. Type PhysicalQueue in the Value field.
  9. Click OK.

Deploying the Application

  1. In deploytool, open the SimpleMessageApp.ear file, which resides in this directory:
  2. <INSTALL>/j2eetutorial14/examples/ejb/provided-ears/

  3. Deploy the SimpleMessageApp application.
  4. In the Deploy Module dialog box:
    1. Select the Return Client JAR checkbox.
    2. In the field below the check box, enter the following:
    3. <INSTALL>/j2eetutorial14/examples/ejb/simplemessage

Running the Client

After you deploy the application, you run the client as follows:

  1. In the directory <INSTALL>/j2eetutorial14/examples/ejb/simplemessage, type the following command on a single line:
  2. appclient -client SimpleMessageAppClient.jar

  3. The client displays these lines:
  4. 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.

  5. In the server log file, the following lines should be displayed, wrapped in logging information:
  6. MESSAGE BEAN: Message received: This is message 1
    MESSAGE BEAN: Message received: This is message 2
    MESSAGE BEAN: Message received: This is message 3

Undeploy the application after you finish running the client.

Removing the Administered Objects

After you run the example, you can use the Admin Console to delete the connection factory and queue. These resources are needed for the JMS examples in Chapters 33 and 34, however, so if you plan to run those examples, do not delete the resources.

Divider
Download
FAQ
History
PrevHomeNext API
Search
Feedback
Divider

All of the material in The J2EE(TM) 1.4 Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.