When testing JMS applications developed for WebSphere Application Server, the development team may not always have access to a WebSphere MQ environment. As a result, you may not be able to troubleshoot and identify defects until the application code has been deployed into an integrated environment. This article shows you how to configure your local WebSphere Test Environment to simulate a WebSphere MQ queue manager and its associated queues, so that you can identify and resolve defects earlier in the development life cycle.
In order to simulate an environment that resembles WebSphere MQ, you will be taking advantage of the WebSphere Application Server default messaging provider for V5, which uses an internal service integration bus (SIBus) that itself contains a messaging engine and associated queues. As a result, instead of defining Java Message Service (JMS) resources to access WebSphere MQ queues, you will define JMS resources to access queue destinations on the SIBus. This article shows you how to define these resources, and includes a sample application that demonstrates placing and retrieving messages to and from the defined queues.
These instructions assume that the local test environment for WebSphere Application Server V6 or later has been installed in your development environment. For users of WebSphere Application Server V7, the Java Software Development Kit (SDK) must be at least at V1.6.0 Java Technology Edition SR9 FP1 for WebSphere Application Server, or at the latest Java SDK version for WebSphere Application Server V7.
The sample application uses the resources shown in Table 1 below. This article walks you through defining each of these resources, and shows you how to customize these instructions for your specific application. For the sample application, you will define two queues under the WebSphere Application Server V5 messaging provider. The first queue, called IncomingQueue, is designated for incoming messages that are processed by the application. The second queue, called OutgoingQueue, stores messages sent by the sample application. These two internal queues simulate their corresponding WebSphere MQ queues and, for each of these queues, you will define corresponding JMS queues and queue connection factories (QCFs).
The sample application has a message-driven enterprise Java bean (EJB) called IncomingMessageReceiverBean. It listens for messages via the IncomingListenerPort listener port and it receives messages placed on the IncomingQueue queue. The application uses a stateless session EJB called OutgoingMessageSenderBean to send messages to the OutgoingQueue queue.
Table 1. Resources used by the sample application
| WebSphere queue name | JMS queue | JMS QCF | Listener port | EJB name |
|---|---|---|---|---|
| IncomingQueue | jms/IncomingQueue | jms/IncomingQCF | IncomingListenerPort | IncomingMessageReceiverBean |
| OutgoingQueue | jms/OutgoingQueue | jms/OutgoingQCF | --- | OutgoingMessageSenderBean |
When configuring the local WebSphere Test Environment for your particular application, use the same Java Naming and Directory Interface (JNDI) names that are defined in your integrated WebSphere environment.
Creating JMS queue destination
For any JMS application running on WebSphere Application Server, the normal configuration process includes defining JMS queues for your specific messaging provider (such as WebSphere MQ). For this scenario, you will define queue destinations for the WebSphere V5 messaging provider. Using Rational Application Developer (or an equivalent integrated development environment), start up the WebSphere test server and perform the following steps:
- Log into the Administrative Console and go to Resources => JMS Providers => V5 default messaging provider (Use Server scope).
- Under the Additional Properties heading, click WebSphere queue destinations or Queues, depending on your WebSphere version
- Click New to create a new queue destination for each of the JMS resources shown in Table 2 below. Note the queue name, since you will use this value later when creating queues on the SIBus.
Table 2. WebSphere queue destination values
| Queue Name | Queue JNDI name |
|---|---|
| IncomingQueue | jms/IncomingQueue |
| OutgoingQueue | jms/OutgoingQueue |
When creating JMS queue destinations for your specific application, the JNDI names should match the names defined in your integrated environment under Resources => JMS Providers => WebSphere MQ => WebSphere MQ queue destinations, which is where the base queue name and associated queue manager name are specified.
- Click OK to save locally and then save changes to the master configuration.
Creating JMS queue connection factories
For each JMS queue used by a JMS application, a corresponding JMS QCF is also required. For this configuration, you will create QCFs under the WebSphere V5 default messaging provider. Perform the following steps on your test server:
- In the Administrative Console, go to Resources => JMS Providers => V5 default messaging.
- Under the Additional Properties heading, click WebSphere queue connection factories or Queue connection factories, depending upon your version.
- Click New to create a new QCF for each resource shown in Table 3 below:
Table 3. WebSphere Queue Connection Factory values
| QCF Name | QCF JNDI Name |
|---|---|
| IncomingQCF | jms/IncomingQCF |
| OutgoingQCF | jms/OutgoingQCF |
When creating the JMS QCFs for your specific application, the JNDI names should match the names defined in your integrated environment under Resources => JMS Providers => WebSphere MQ => WebSphere MQ queue connection factories, which is where the queue manager and channel detail are specified.
- Click OK to save locally and then save changes to the master configuration.
Defining port settings for the JMS server
This section shows you how to update settings associated with the JMS provider of your local server:
- In the administrative console, go to Servers => (WebSphere) Application Servers => <serverName>.
- Under the Communications heading, click the Ports link. Take note of the port value for the MQ transport port named SIB_MQ_ENDPOINT_ADDRESS.
- Click New to create a new port and select JMSSERVER_QUEUED_ADDRESS from the Well-known port field. Enter the hostname of your test server for the Host field and enter the port number used by SIB_MQ_ENDPOINT_ADDRESS in the Port field.
- Click OK to save locally and then save changes to the master configuration
Creating a service integration bus
Service integration technology is integrated into WebSphere Application Server to accommodate asynchronous messaging services. The default messaging providers for WebSphere Application Server use this service integration technology. In this step, you will define an SIBus and then join the application server to the bus as a bus member, which causes WebSphere Application Server to automatically create a messaging engine for it. The application server uses the messaging engine for sending and receiving messages to destinations on the bus. You can also use an existing SIBus, if available, rather create a new one.
- From the Administrative Console, go to Service integration => Buses.
- Click New to create a new SIBus
- Enter a name for the bus, deselect the Secure checkbox, and then click Apply or Finish.
- Under the Topology heading of your new bus, click Bus members.
- Click Add to add the application server as a bus member.
- Select the Server radio button, select <nodeName : serverName>, and keep the Default field for the data store.
- Click Next and then Finish.
- Click OK to save locally and then save changes to the master configuration. A messaging engine has been created for your server under Service integration=> Buses => <busName> => Messaging engines.
Creating the internal queue manager
In the previous steps you configured the JMS resources used by the sample application. However, since you are using the V5 default messaging provider, you will also need to create an association between these JMS resources and their corresponding queue destinations on the SIBus. Because the V5 default messaging provider uses WebSphere MQ client protocols, this association is called the WebSphere MQ client link. It provides the bridge for any JMS application to communicate with the V5 JMS resources and the messaging engine on the SIBus, as shown in Figure 1 below. As a result, the WebSphere MQ client link acts as an internal queue manager and enables access to destinations on the SIBus.
Figure 1. Connectivity between messaging engine and JMS application

Follow the steps below to create and configure the WebSphere MQ client link:
- From the Administrative Console, go to Service Integration => Buses => <busName>.
- Under the Topology heading, click Messaging Engines.
- Click on the <nodeName>.<serverName>-<busName> link.
- Under the Additional Properties heading, click WebSphere MQ client links.
- From the next screen, click New to create a new WebSphere MQ client link with the values shown in Table 4 below:
Table 4. WebSphere MQ client link values
| Field name | Field value | Comments |
|---|---|---|
| Name | Default.MQClientLink | Use any value for this field |
| MQ Channel Name | WAS.JMS.SVRCONN | Channel name configured for V5 |
| Queue Manager Name | WAS_<nodeName>_<serverName> | The correct value is initially displayed by default |
| Default queue manager | Checked |
- Click OK to save locally and then save changes to the master configuration.
Creating queue destinations on the service integration bus
For each JMS queue defined for the WebSphere V5 messaging provider, you will need to create a corresponding destination on your SIBus. This section shows you how to create a queue destination on your SIBus and then assign it to the application server bus member:
- From the Administrative Console, go to Service Integration => Buses => <busName>.
- Under the Destination Resources heading, click Destinations.
- On the next screen, select New to create a bus destination for each row in Table 5 below. The following steps walk you through each screen.
Table 5. Queue Bus destination values
| Destination type | Identifier | Bus member |
|---|---|---|
| Queue | IncomingQueue | <nodeName>:<serverName> |
| Queue | OutgoingQueue | <nodeName>:<serverName> |
- On the Create new destination screen, select the Queue destination type.
- On the Set queue attributes screen, enter the queue name from Table 5 above. This value is the same as the queue name used for the WebSphere V5 messaging provider JMS queue (see Table 2 above). For your specific JMS application, the name of your WebSphere V5 JMS queue should match the name used for its corresponding bus queue.
- On the Assign the queue to a bus member screen, select the bus member name <nodeName>:<serverName>. The bus member represents your application server.
- On the Confirmation screen, click Finish to create the queue.
- After creating both queues from Table 5 above, save the changes to the master configuration
Creating alias destinations on the service integration bus
Next you must create an alias destination for each of the queue destinations that you created above. For the sample application, the field values for each alias are summarized in Table 6 below. For the alias name, the WQ_ prefix must be used. The following steps walk you through each of the screens:
Table 6. Queue bus destination values
| Destination type | Identifier | Target identifier | Target bus |
|---|---|---|---|
| Alias | WQ_IncomingQueue | IncomingQueue | <busName> |
| Alias | WQ_OutgoingQueue | OutgoingQueue | <busName> |
- On the Create new destination screen, select the Alias destination type.
- On the Set alias destination attributes screen, enter the alias name from Table 6 above for the Identifier field. The naming convention for each alias destination is WQ_ followed by the queue bus destination name. Be careful to enter the alias name correctly and without any added spaces, because misspelling the alias name can prevent the entire configuration from working properly.
- Skip the Target Identifier field. If the Target Bus dropdown is not already populated, then select the name of your bus from the Target Bus dropdown field. The Administrative Console interface automatically populates the Target Identifier field with values.
- Select the appropriate value from the Target Identifier field, as specified in Table 6 above.
- Leave default values for remaining fields, click Next, then click Finish on the Confirmation screen.
- Save the changes to the master configuration.
After the above changes have been completed, Queue Points are automatically created for the <nodeName>:<serverName> messaging engine for your SIBus. The queue points for the sample application are listed below:
- IncomingQueue@<nodeName>:<serverName>-<busName>
- OutgoingQueue@<nodeName>:<serverName>-<busName>
Messages sent to the JMS queues are stored and processed at the queue point. To view queue points, go to Service Integration =>Buses=> <busName> => Messaging Engines=> <nodeName>:<serverName>-<busName> => Queue points.
Creating the MDB listener port
The last resource you will configure for the sample application is the listener port for the IncomingMessageReceiverBean message-driven bean. Follow the steps below:
- In the Administrative Console, go to Servers => Application Servers => <serverName>.
- Under the Communications heading, expand the Messaging section and go to Message Listener Service.
- Under Additional Properties heading, click on Listener Ports.
- On the next screen, click New to create a new listener port. For the sample application, you will use the values shown in Table 7 below:
Table 7. Listener port values
| Listener port | QCF JNDI | Queue destination JNDI |
|---|---|---|
| IncomingListenerPort | jms/IncomingQCF | jms/IncomingQueue |
For your particular JMS application, if you are using message-driven beans, then the listener port name should match the value associated with your message driven bean, and the JNDI values should match with the JMS resources defined for your application.
- Click OK and then save the changes to the master configuration.
- Finally, restart your test server to make sure that all of the changes take effect.
Checking service integration security
If you do not have global security enabled for your WebSphere test server, skip this section and continue to Running the sample application below. If global security is enabled for your server, then bus and messaging security are enabled automatically by default and you should consider the following options:
- Disable bus security. You can still enable global security without having bus security enabled.
- Keep bus security enabled and perform additional steps to configure client authentication, authorization policies, and secure transport chains.
Configuring service integration security is beyond the scope of this article. For more information about administering service integration security, see Resources below. Here is how to disable bus security for your test server:
- In the Administrative Console, go to Service Integration => Buses => <busName>.
- If your WebSphere test server is V7.0 or later:
- Under Additional Properties, click on Security.
- Deselect the Enable bus security checkbox.
- Within the Permitted transports section, select Allow the use of all defined transport channel chains.
- Click OK and then save the changes to the master configuration.
- Restart your server.
- If your WebSphere test server is V6:
- Under General Properties, deselect the Secure checkbox .
- Click OK and then save the changes to the master configuration.
- Restart your server.
For more information about service integration security, see Resources below.
Running the sample application
The sample application lets you place text messages on the IncomingQueue and retrieve messages from the OutgoingQueue. The IncomingMessageReceiverBean message-driven bean automatically picks up any messages from the IncomingQueue and passes the message to the OutgoingMessageSenderBean stateless session bean. The OutgoingMessageSenderBean then puts the message on the OutgoingQueue. Two JSPs have been created to send messages to the IncomingQueue and retrieve from the OutgoingQueue. To run the application, following the steps below:
- Download the sample JMS application at the bottom of the article and unzip the file into a temporary directory.
- Import SampleJMSApplication.ear into an Enterprise Application project. Once imported, you should see the three projects shown in Figure 2 --
one Enterprise Application project, one EJB project, and one Dynamic Web project:
Figure 2. Sample JMS Application projects

- Start up your test server and add the SampleJMSApplication project.
- Open a Web browser and enter http://localhost:<portNumber>/SampleJMSApplicationWeb/
where <portNumber> is the port number associated with your application server. - From the Put Message screen (see Figure 3), enter any text into the MessageText field and click Put Message to send a message to the IncomingQueue:
Figure 3. Put Message screen

- To retrieve this message, click on Retrieve message from OutgoingQueue.
- From the Get Message screen (Figure 4), click Get Message to retrieve a message from the OutgoingQueue:
Figure 4. Get Message screen

This article has shown you how to define two internal WebSphere V5 queues that simulate WebSphere MQ queues. You can use these same steps to configure additional queues for your specific JMS application. Once configuration is complete for your application, you can test your JMS application without being connected to a WebSphere MQ queue manager. The sample application showed how you can use this configuration to send messages to and retrieve messages from the simulated WebSphere MQ environment. You can now set up your own local test environment to verify whether your code handles incoming messages and sends outgoing messages correctly.
| Description | Name | Size | Download method |
|---|---|---|---|
| Sample JMS Enterprise Application for this article | SampleJMSApplication.zip | 59 KB | HTTP |
Information about download methods
- WebSphere Application Server resources
- WebSphere Application Server information center
A single Web portal to all WebSphere Application Server documentation, with conceptual, task, and reference information on installing, configuring, and using WebSphere Application Server. - Enabling WebSphere Application Server V5.1 JMS usage of messaging resources in later versions
This topic in the WebSphere Application Server information center provides the technical background for this article - Service integration security
This topic provides helpful information for understanding service integration security for V7.0 or later. - Learning about service integration security
This topic provides helpful information for understanding service integration security for V6. - Securing service integration
This topic shows you how to administer service integration security for V7.0 or later. - Administering messaging security
This topic shows you how to administer service integration security for V6. - WebSphere Application Server developer resources page
Technical resources to help you use WebSphere Application Server. - WebSphere Application Server product page
Product descriptions, product news, training information, support information, and more. - WebSphere Application Server information roadmaps
Roadmap of articles and resources to help you with installation, migration, administration, development, troubleshooting, and understanding the underlying technology. - WebSphere Application Server documentation library
WebSphere Application Server product manuals. - WebSphere Application Server support
A searchable database of support problems and their solutions, plus downloads, fixes, and problem tracking. - Download a free trial version of WebSphere Application Server V7
WebSphere Application Server V7 is a Java EE 5 certified, EJB 3.0 supported application platform that drives business agility with an innovative, performance based foundation for your SOA environment on the broadest range of platforms in the industry.
- WebSphere Application Server information center
- WebSphere resources
- developerWorks WebSphere developer resources
Technical information and resources for developers who use WebSphere products. developerWorks WebSphere provides product downloads, how-to information, support resources, and a free technical library of more than 2000 technical articles, tutorials, best practices, IBM Redbooks, and online product manuals. - developerWorks WebSphere application integration developer resources
How-to articles, downloads, tutorials, education, product info, and other resources to help you build WebSphere application integration and business integration solutions. - Most popular WebSphere trial downloads
No-charge trial downloads for key WebSphere products. - WebSphere forums
Product-specific forums where you can get answers to your technical questions and share your expertise with other WebSphere users. - WebSphere on-demand demos
Download and watch these self-running demos, and learn how WebSphere products and technologies can help your company respond to the rapidly changing and increasingly complex business environment. - developerWorks WebSphere weekly newsletter
The developerWorks newsletter gives you the latest articles and information only on those topics that interest you. In addition to WebSphere, you can select from Java, Linux, Open source, Rational, SOA, Web services, and other topics. Subscribe now and design your custom mailing. - WebSphere-related books from IBM Press
Convenient online ordering through Barnes & Noble. - WebSphere-related events
Conferences, trade shows, Webcasts, and other events around the world of interest to WebSphere developers.
- developerWorks WebSphere developer resources
- developerWorks resources
- Trial downloads for IBM software products
No-charge trial downloads for selected IBM® DB2®, Lotus®, Rational®, Tivoli®, and WebSphere® products. - developerWorks blogs
Join a conversation with developerWorks users and authors, and IBM editors and developers. - developerWorks cloud computing resources
Access the IBM or Amazon EC2 cloud, test an IBM cloud computing product in a sandbox, see demos of cloud computing products and services, read cloud articles, and access other cloud resources. - developerWorks tech briefings
Free technical sessions by IBM experts to accelerate your learning curve and help you succeed in your most challenging software projects. Sessions range from one-hour virtual briefings to half-day and full-day live sessions in cities worldwide. - developerWorks podcasts
Listen to interesting and offbeat interviews and discussions with software innovators. - developerWorks on Twitter
Check out recent Twitter messages and URLs. - IBM Education Assistant
A collection of multimedia educational modules that will help you better understand IBM software products and use them more effectively to meet your business requirements.
- Trial downloads for IBM software products
Annette Green works as a Senior I/T Specialist for IBM Global Business Services in the Washington, D.C. area. She has 15 years of experience in enterprise application design and development, and system integration. Annette is an IBM-certified MQ developer, a Sun-certified Java programmer, and the creator of two WebSphere MQ SupportPacs: MA0J and MA92. You can contact Annette at greenac@us.ibm.com.




