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:
- In the tree component, expand the Resources node, then expand the JMS Resources node.
- Select the Connection Factories node.
- On the JMS Connection Factories page, click New. The Create JMS Connection Factory page appears.
- In the JNDI Name field, type
jms/ConnectionFactory
.- Choose
javax.jms.ConnectionFactory
from the Type combo box.- Select the Enabled checkbox.
- Click OK.
To create the physical destination, perform the following steps:
- In the tree component, expand the Resources node, then expand the JMS Resources node.
- Select the Physical Destinations node.
- On the Physical Destinations page, click New. The Create Physical Destination page appears.
- In the Physical Destination Name field, type
PhysicalQueue
.- Choose
queue
from the Type combo box.- Click OK.
To create the destination resource and link it to the physical destination, perform the following steps:
- In the tree component, expand the Resources node, then expand the JMS Resources node.
- Select the Destination Resources node.
- On the JMS Destination Resources page, click New. The Create JMS Destination Resource page appears.
- In the JNDI Name field, type
jms/Queue
.- Choose
javax.jms.Queue
from the Type combo box.- Select the Enabled checkbox.
- In the Additional Properties area, type
PhysicalQueue
in the Value field for theName
property.- Click OK.
Deploying the Application
Running the Client
After you deploy the application, you run the client as follows:
- In the directory
<
INSTALL
>/j2eetutorial14/examples/ejb/simplemessage
, type the following command on a single line:
appclient -client SimpleMessageAppClient.jar
- 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.- 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 3Undeploy 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.