Download PDF Home History |  | API Search Feedback FAQ

> ## 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:

> - A JMS connection factory resource
> - A JMS destination resource
> - A physical destination to which the destination resource refers

> 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 Resources node, then expand the JMS Resources 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, expand the Resources node, then expand the JMS Resources node.
> 2. Select the Physical Destinations node.
> 3. On the Physical Destinations page, click New. The Create Physical Destination page appears.
> 4. In the Physical Destination Name field, type `PhysicalQueue`.
> 5. Choose `queue` from the Type combo box.
> 6. Click OK.

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

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

> ### Deploying the Application

> 1. In `deploytool`, open the `SimpleMessageApp.ear` file, which resides in this directory:

> `<``INSTALL``>/j2eetutorial14/examples/ejb/provided-ears/`

> 2. Deploy the `SimpleMessageApp` application.
> 3. In the Deploy Module dialog box:
> 1. Select the Return Client JAR checkbox.
> 2. In the field below the checkbox, enter the following:

> `<``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:

> `appclient -client SimpleMessageAppClient.jar`

> 2. The client displays these lines:

> `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.`

> 3. In the server log file, the following lines should be displayed, 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`

> 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.

Download PDF Home History |  | API Search Feedback FAQ

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.