Solving the NameNotFoundException when connecting to IBM MQ through JMS

If you are facing an exception like the one at [0], then the problem might be hard to figure out. Because, if you look at the Queues in the MQ explorer, the queu named FOOQ will be there.

So, the missing part here is the JMS binding of that queue. This takes 10 minutes to solve. Right click on the queue, and select ‘create JMS queue’. Pick the JNDI Context you have created (creating this is out of scope of this post), and just click next, next and finish. Now re-generate the JNDI bindings by running IVTSetup.bat, and copy it over to the client machine and use it.

Your problem should be solved by now and you will be happily putting messages to IBM MQ Queues.

[0] –

TID: [0] [ESB] [2013-03-20 19:01:11,515] ERROR {org.apache.axis2.transport.jms.JMSConnectionFactory} -  Error looking up the JMS destination with name FOOQ of type generic {org.apache.axis2.transport.jms.JMSConnectionFactory}
javax.naming.NameNotFoundException: dynamicQueues/FOOQ
    at com.sun.jndi.fscontext.RefFSContext.getObjectFromBindings(RefFSContext.java:400)
    at com.sun.jndi.fscontext.RefFSContext.lookupObject(RefFSContext.java:327)
    at com.sun.jndi.fscontext.RefFSContext.lookup(RefFSContext.java:146)
    at com.sun.jndi.fscontext.FSContext.lookup(FSContext.java:127)
    at org.wso2.carbon.context.internal.CarbonContextDataHolder$CarbonInitialJNDIContext.lookup(CarbonContextDataHolder.java:1030)
    at javax.naming.InitialContext.lookup(InitialContext.java:411)
    at org.apache.axis2.transport.jms.JMSUtils.lookup(JMSUtils.java:509)
    at org.apache.axis2.transport.jms.JMSUtils.lookupDestination(JMSUtils.java:718)
    at org.apache.axis2.transport.jms.JMSConnectionFactory.getDestination(JMSConnectionFactory.java:198)
    at org.apache.axis2.transport.jms.JMSMessageSender.<init>(JMSMessageSender.java:88)
    at org.apache.axis2.transport.jms.JMSSender.sendMessage(JMSSender.java:120)
    at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
    at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
    at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:456)
    at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:57)
    at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:316)
    at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:329)
    at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:59)
    at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:175)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
    at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:367)
    at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:408)
    at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:219)

    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)
TID: [0] [ESB] [2013-03-20 19:01:12,045] ERROR {org.apache.synapse.core.axis2.Axis2Sender} -  Unexpected error during sending message out {org.apache.synapse.core.axis2.Axis2Sender}
org.apache.axis2.transport.jms.AxisJMSException: Error looking up the JMS destination with name FOOQ of type generic
    at org.apache.axis2.transport.jms.JMSConnectionFactory.handleException(JMSConnectionFactory.java:228)
    at org.apache.axis2.transport.jms.JMSConnectionFactory.getDestination(JMSConnectionFactory.java:200)
    at org.apache.axis2.transport.jms.JMSMessageSender.<init>(JMSMessageSender.java:88)
    at org.apache.axis2.transport.jms.JMSSender.sendMessage(JMSSender.java:120)
    at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
    at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
    at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:456)
    at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:57)
    at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:316)
    at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:329)
    at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:59)
    at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:175)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
    at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:367)
    at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:408)
    at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:219)

    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)
Caused by: javax.naming.NameNotFoundException: dynamicQueues/FOOQ
    at com.sun.jndi.fscontext.RefFSContext.getObjectFromBindings(RefFSContext.java:400)
    at com.sun.jndi.fscontext.RefFSContext.lookupObject(RefFSContext.java:327)
    at com.sun.jndi.fscontext.RefFSContext.lookup(RefFSContext.java:146)
    at com.sun.jndi.fscontext.FSContext.lookup(FSContext.java:127)
    at org.wso2.carbon.context.internal.CarbonContextDataHolder$CarbonInitialJNDIContext.lookup(CarbonContextDataHolder.java:1030)
    at javax.naming.InitialContext.lookup(InitialContext.java:411)
    at org.apache.axis2.transport.jms.JMSUtils.lookup(JMSUtils.java:509)
    at org.apache.axis2.transport.jms.JMSUtils.lookupDestination(JMSUtils.java:718)
    at org.apache.axis2.transport.jms.JMSConnectionFactory.getDestination(JMSConnectionFactory.java:198)
    ... 20 more

About these ads

One comment on “Solving the NameNotFoundException when connecting to IBM MQ through JMS

  1. Bryan Cruise says:

    Very informative! Such a simple solution to a seemingly complex problem :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s