Simple Point-to-Point JMS Queue
iPlanetTM Application Server Samples

Updated June 12, 2001

If you already went through the deployment process of this sample, you can run the application by clicking here. Otherwise, deploy the application based on the following instructions.

This sample is based on a servlet accessing a point-to-point JMS queue and displaying the results via a JSP. The servlet sends a simple message to a queue and then receives the same message from the queue and displays it via a JSP.

Setting Up the Environment

Getting Started includes a checklist of prerequisites for deploying sample applications to iPlanet.

Before exercising this sample, please review the instructions for installing a JMS provider and configuring it to work with iPlanet Application Server. In order for the sample to work successfully, a JMS provider must be installed and configured.

Deploying and Running the HelloWorld Application

Select one of two approaches to deploying the application:

Command Line-based Deployment describes how to manually register the application in iPlanet using a Command Line Interface (CLI). This is the fastest means of deploying the application.

GUI-based Deployment describes how to use the iPlanet Deployment Tool to import and deploy the application. It also addresses assembling the application from scratch using the Deployment Tool.

Running the Application describes how to start the application, navigate through it and how to troubleshoot in the event of problems.

Further Exploration

Compiling and Assembling the Application describes how to use command line tools to recompile the sources and rebuild the J2EE modules and the overall EAR file.

Known Issues describes the known issues with the sample.


Command Line-based Deployment

You have a choice of  deploying and registering the application through either command line utilities or the iPlanet Application Server Deployment Tool GUI. Since a complete EAR file is supplied, the fastest means of setting up the application is to use the command line utilities as described in this section. If you would like to experience either deploying through a GUI tool or assembling an application from scratch, then follow instructions in GUI-based Deployment.

The pre-built jms-simplequeue.ear file is a Enterprise ARchive file that contains the Web Archive (WAR) application. Within this JAR file resides the XML deployment descriptor files, application class files, JSPs and other content required by the application.

Deploying the pre-built jms-simplequeue.ear file is simple.

1. Go to the root of the sample directory:

install_dir/ias/ias-samples/jms/simplequeue/

2. Execute iasdeploy to deploy application to the local application server instance:

iasdeploy deployapp jms-simplequeue.ear

Refer to the Getting Started section for more information on using the iasdeploy command.

The deployment process involves the following operations:

If you would like to verify the registration of the application, proceed to Verifying Registration.

Otherwise, you're ready to exercise the application by Running the Application.


GUI-Based Deployment

The Deployment Tool provides an easy-to-use means of assembling J2EE applications and deploying applications to iPlanet Application Server. For most cases, use of Deployment Tool is recommended over the approach of manually creating XML-based deployment descriptors and manually assembling J2EE modules and application JAR files.

Two approaches to using the Deployment Tool are described:

Import Pre-existing EAR File to quickly deploy the sample application to iPlanet using the Deployment Tool. None of the application assembly steps are covered by this section. On average, this approach will take 5-10 minutes.

or

Assemble the Application to learn how to use Deployment Tool to assemble the sample application from scratch and to deploy it to the application server. On average, this approach will take from 15-20 minutes.

Import Pre-existing EAR File

Since a pre-built Enterprise ARchive (EAR) file for the sample application is included with the application server, you can use the Deployment Tool to quickly read in the .ear file and deploy it to the application server.

Open the pre-existing sample EAR file.

  1. Launch the Deployment Tool.
  2. UNIX:
    Execute install_dir/ias/bin/deploytool
    Windows:
    Start->Programs->iPlanet Application Server 6.0->iAS Deployment Tool
  3. Open the EAR file

Assemble the Application

This approach involves assembling the sample application from scratch. After compiling the Java sources, you will start Deployment Tool and create the application WAR and EAR files. Then you will deploy the application to the application server.

Compile Application Sources

To compile the application sources, you can use either the simple script file with the servlet source file or the more complex build facility described in Compiling and Assembling the Application section at the end of this document. If the script file is used to compile the servlet, it's necessary to verify that IAS_HOME is set correctly at the top of the script.

If you choose to use the build facility, then you will need to issue the command "build compile" after you have established the build environment.

You might want to use the compile scripts first and then try out the build facility after you successfully deploy and run the application. The compile script is located in the ias-samples/jms/simplequeue/src/samples/jms/simplequeue/ directory.

Create WAR Module

Identify the Content for WAR File

1. Create assembly location:
Create the new directory install_dir/ias/ias-samples/jms/simplequeue/assemble/ outside the Deployment Tool. You will assemble the application into archive files and save them to this directory.
2. Launch the Deployment Tool:
UNIX:
Execute install_dir/ias/bin/deploytool
Windows:
Start->Programs->iPlanet Application Server 6.0->iAS Deployment Tool
3. Create jms-simplequeue.war: 4. Now insert all class files needed in the jms-simplequeue.war file: 5. Add JSP file to the .war file 6. Review the SimpleQueueServlet XML descriptor (this is an optional step): 7. Modify the Web Application XML descriptor 8. Save and close the web application archive Now that you've assembled the WAR module, you are ready to create the Enterprise ARchive (EAR) file.

Assemble jms-simplequeue.ear

1. Create jms-simplequeue.ear: 2. Add jms-simplequeue.war: 3. Review the application XML descriptor (this is an optional step): 4. Modify the Web Application Context Root 4. Save jms-simplequeue.ear:

Deploy the Application

Now you're about to deploy the application by transferring the EAR file to a target iPlanet Application Server. First, you will identify the target server. After the EAR file is deployed to the server, registration occurs. After deployment completes, you will be able to run the application. No server restart is required.

If you followed the assembly instructions, then jms-simplequeue.ear is opened in Deployment Tool. If you opened the pre-existing EAR file, you are working with install_dir\ias\ias-samples\jms\simplequeue\jms-simplequeue.ear. If you are following the "Create EAR File from Scratch" instructions, you are modifying install_dir\ias\ias-sample\jms\simplequeue\assemble\jms-simplequeue.ear.

If you entered all deployment information manually, you can skip the following steps 1 to 3, because you have entered this information already.

1. Select the jms-simplequeue.ear file under the J2EE Application window.

2. Select File -> Deploy

3. If you have not already registered a target application server, do so now by clicking on the Register button. Enter the host name, administrative port number and username/password for the target application server. Otherwise, select a pre-registered target server.

Note: You may authorize additional users to deploy applications to an iAS server by using the iAS Administrative Console. See the Security settings tab in the iAS Administrative Console.
4. If you deployed jms-simplequeue.ear previously, then select Overwrite Modules.

5. Click on Deploy to start the deployment process.

6. Now the file transfer and application registration begins. See the Deploy tab for the status of the deployment. The deployment may take several minutes to complete.

Verifying Registration

As an optional step, you can use the iPlanet Application Server Administration Tool to verify that the application has been registered. If you do not want to verify that the application has been registered, proceed directly to Running the Application.
  1. Start the iPlanet Application Server Admin Tool
  2. UNIX:
    install_dir/ias/bin/ksvradmin
    Windows:
    Start->Programs->iPlanet Application Server->iAS Administration Tool
  3. Connect to your application server instance by selecting File->New->Server. Click on Localhost to specify the default connection settings. Enter the iPlanet Application Server's administrator's password and click on OK.
  4. Select the server name (default name of iAS1) and select the Application button in the top right hand corner of the window to see the applications registered in this instance of the application server.
  5. You should one folder for the "jms-simplequeue" J2EE application. The "jms-simplequeue" folder with the world icon represents the web application module.
To see more details associated with the sample application, you can browse the iPlanet Application Server Registry using a tool named kregedit:
  1. Execute kregedit to start the iAS Registry Editor GUI.
  2. Navigate to the SOFTWARE/iPlanet/Application Server/6.0/ portion of the tree.
  3. Browse the J2EE-Application/ tree and look for the "jms-simplequeue" application.
  4. Expand the "jms-simplequeue" folder and explore this portion of the directory tree.
  5. Now open the J2EE-Module/ tree and look for the "jms-simplequeue" web application module entry.
  6. Expand each of these folders and explore their contents.
  7. Once you find the GUID associated with servlet in the sample application, you can navigate through the SOFTWARE/iPlanet/Application Server/ClassDef/ folders to find out more details on the servlet. Expanding the matching GUID folder under the ClassDef folder will show you the detailed settings associated with the servlet.
Now you're ready to exercise the sample application. 

Running the Application

To run the application, go to the following URL:
http://<web server hostname>:<port>/NASApp/simplequeue/SimpleQueueServlet
The following page should be displayed in the browser:
Simple Point-to-Point Queue
iPlanet Application Server JMS Sample Applications

Simple queue sample was: SUCCESSFUL

Message received:
  JMSMessageID:  ID:414d5120514d5f676e656c736f6e5f6eab33253a13600200
  JMSXDeliveryCount:  1
  JMSTimestamp:  975545248260
  JMSDeliveryMode:  2
  JMSXAppID:  iplanet\ias6\ias\bin\kjs.exe
  Text:  This is a sample message. It was sent at Wed Nov 29 18:47:21 CST 2000
  JMS_IBM_PutApplType:  11
  JMSType:  null
  JMSExpiration:  0
  JMSPriority:  4
  JMSReplyTo:  null
  JMS_IBM_Format:  MQSTR
  JMSRedelivered:  false
  JMSXUserID:  SYSTEM
  JMS_IBM_MsgType:  8
  JMSDestination:  queue:///SYSTEM.DEFAULT.LOCAL.QUEUE
  JMSCorrelationID:  null

Troubleshooting

If you encounter problems when running the application, review the General Troubleshooting section to learn how to view logs files.

Further Exploration

After running the sample successfully, modify the servlet source code to not issue a receive on the queue. This modification will help you verify that a message is actually being placed on the specified queue.

  1. Modify the SimpleQueueServlet to comment out the message receive step.
  2. Rebuild the application using the sample application build facility (see next section).
  3. Reregister the application.
  4. Restart the application server.
  5. Access the servlet again. (You should see an unsuccessful message)
  6. Use the JMS provider's administrative utilities to browse the messages on the queue. Refer to the JMS provider setup instructions for details.

Compiling and Assembling the Application

To easily recompile, assemble and deploy the application, see the Sample Application Build Facility document for details on using a build facility to quickly perform these tasks.

For example, to rebuild the entire application from scratch, follow these steps:

1. Compile and Assemble the Web Application

Execute "build" under jms/simplequeue/src/

The default target core will be executed to rebuild the WAR and EAR files.

2. Redeploy Application

Execute "build deploy" under jms/simplequeue/src/

3. Restart Application Server

An application server restart will be necessary if you've modified deployment descriptors. For servlet and/or JSP modification, no restart is is necessary.

To clean the web application project area, execute "build clean".

Known Issues

A message is printed out in the log - "unable to load message > catalog - mqji".

This typically happens the first time the sample is executed. This can be safely ignored.

Copyright (c) 2001 Sun Microsystems, Inc. All rights reserved.