Thursday, 27 June 2013

Websphere MQ Install, Setup, and Java Hello World

Today I thought I'd walk through the process of getting Websphere MQ (or MQ Series) up and running on Windows 7, doing a really basic setup and then writing a Hello World Java app that puts/gets a test message onto/from a queue.

I've divided it into 2 blog posts:

  • Part 1: MQ setup. 
  • Part 2: Java stuff.

Part 1: MQ Setup

The version of MQ I've been playing with is v7.5, although from what I understand it should be fairly similar from v7.1 upwards. Also, you need to be running a windows account that has local admin rights on your box.

Installing MQ

Download the installer, unzip and run the setup.exe  program. This runs the launch pad:

The launch pad walks through checking the necessary prerequisites. 

  • Click "Network Configuration". Select 'No' to the domain controller question; this avoids complicating the setup down track. 
  • Click "WebSphere MQ Installation", then "Launch IBM WebSphere MQ Installer". This kicks off the proper installer program.
  • Accept the terms, and select "Typical" setup type. This includes the basic tools and Java support. If you need to go for a custom install, ensure that at a minimum you enable "MQ Explorer", "Java and .Net Messaging and Web Services" and "Development Toolkit". Otherwise you won't get the bits and bobs we'll need later on.
Once the MQ installer sorts itself out, it'll ask you again about domain controllers. Select "No".  When its finished with the install, you're going to want to launch the MQ Explorer:

If you get this far and the MQ installer managed to start the service up without errors, then the install is done and should be fine. 

Basic Setup

The most basic setup for MQ involves creating the following object types:
  • Queue Manager
  • Queue
  • Listener
  • Channel

To create the queue manager, right click over the "Queue Managers" folder in the left hand panel of MQ Explorer, then "New"->"Queue Manager..."

Set the name to "TEST.QM". Tick the box to make it the default queue manager, then click "Finish".

MQ will ponder for a while, then will install and fire up your new queue manager. Explorer should look like this when its done:

While creating the queue manager it should also have created a listener object for itself. This lets you connect to the queue manager over TCP/IP. The default port is 1414. Expand TEST.QM and click on "Listeners".  You should see it listed, and hopefully it should be running. If you already had an application that had bound to port 1414, then you'll need to edit the listener properties and select a different port. If running correctly, it should look as follows:

Next we need to create a queue. Right-click on "Queues", then "New"->"Local Queue...". Call the queue "TEST.Q", then click "Finish".

Time to create the channel. This is the last object we'll need. Right-click on "Channels", then "New"->"Server-connected Channel...". Call it "TEST.SC", then click "Finish".

Despite being created correctly, the channel status will still be marked as "Inactive". Server channels do not become active until a connection from some client is established.


Even though the setup is good, if you close down MQ Explorer and re-open it, you'll appear to have lost everything. You won't see your queue manager, and wont even have the option to create a new one! This is because your user doesn't have the correct entitlement.

You'll need to add your windows user to the "mqm" group. This was created during the install, and membership of it entitles you to administer MQ. Add your user to the group and reboot your machine. [There's certain to be MQ runes that avoid the reboot, but they have proved illusive...]. After the reboot, re-launch MQ Explorer, and all should be well.

The other issue that has to be dealt with is channel security. By default access is disabled (from around version 7.1 and above), which means that when we try to run the Hello World Java program, the connection will fail with a "2035 MQRC_NOT_AUTHORIZED"

There are several options here. You can manage fine grained control of security policy using the setmqaut command which you'd want to do for production. But since this is (hopefully!) a development instance, we're going to completely disable channel security for our test queue manager.
  • Open a cmd window
  • Connect to the queue manager admin tool. Type: "runmqsc TEST.QM". The tool runs in interactive mode.
  • Type: "END" to quit the admin tool.
Your command window should look like this:

This is the end of Part 1. I'll go through the Java client in my next post.


Tuesday, 11 June 2013


Hello and welcome to my blog. My name is Chris Tarpy, and I'm a code monkey  As I take my daily walk through the jungle, if any useful bananas come my way, I may depositing them here.

To talk to the monkey:, or