35.3. Configuring WebSphere MQ

WebSphere MQ JMS administration is documented in the WebSphere MQ Using Java document.

The configuration file of the JMS administration tool must be edited so that the JOnAS registry is used for binding the JMS objects. This file is the JMSAdmin.config file located in WebSphereMQ's Java/bin directory. Set the factory and provider URL as follows:

INITIAL_CONTEXT_FACTORY=
  org.objectweb.rmi.libs.services.registry.jndi.JRMIInitialContextFactory
PROVIDER_URL=jrmi://localhost:2000

You also need to add JOnAS's client.jar library to WebSphere MQ's classpath.

When starting, JOnAS expects JMS objects to have been created and bound to the registry. Those objects are connection factories, needed for connecting to WebSphere MQ destinations and other destinations.

JOnAS automatically tries to access the following factories:

If one of these objects cannot be found, JOnAS prints a message similar to this:

JmsAdminForWSMQ.start : WebSphere MQ XAConnectionFactory 
  could not be retrieved from JNDI

This does not prevent JOnAS from working. However, if no connection factory is available, no JMS operations are possible from JOnAS.

If destinations have been declared in the jonas.properties file, JOnAS also expects to find them. For example, if the following destinations are declared:

jonas.service.jms.topics    sampleTopic
jonas.service.jms.queues    sampleQueue

The server expects to find the following JMS objects in the registry:

If one of the declared destinations cannot be retrieved, the following message appears and the server stops:

JOnAS error: org.objectweb.jonas.service.ServiceException: 
 Cannot init/start service jms': 
 org.objectweb.jonas.service.ServiceException : 
 JMS Service Cannot create administered object: java.lang.Exception:
 WebSphere MQ Queue creation impossible from JOnAS

Contrary to connection factories, the JOnAS administration tool enables you to create destinations. As it is not possible to create WebSphere MQ JMS objects from JOnAS, this works only if the destinations are previously created through WebSphere MQ and bound to the registry.

For example, an attempt to create a queue named "myQueue" through the JonasAdmin tool works only if:

To launch WebSphere MQ administration tool, enter: JMSAdmin

The following prompt appears: InitCtx>

To create a QueueConnectionFactory and bind it with the name JQCF, enter:

InitCtx> DEF QCF(JQCF)

You can add more parameters (for example, to specify the queue manager).

To create a Queue that represents a WebSphere MQ queue named myWSMQqueue and bind it with the name sampleQueue, enter:

InitCtx> DEF Q(sampleQueue) QUEUE(myWSMQqueue)

You can view objects bound in the registry by entering:

InitCtx> DIS CTX