Wednesday, December 4, 2013

Configure Hermes JMS To Connect Websphere MQ 7.1

Hermes JMS is a good UI based tool to connect to JMS queues that allows all common operations like put, get, browse etc as well as some really rich features. Another plus point with Hermes is its vendor neutral! It can connected to almost any JMS based messaging system with minor configuration.

Recently I configured it with Websphere MQ 7.1. I did faced minor issue initially but later it went smoothly. So here are the steps -


  • Install Websphere MQ on linux as provided in this link. You need to install MQSeriesClient as well to get the required jars which we will use later in Hermes configuration.
  • Copy all the below jars from /<Websphere_MQ_Install_Folder>/java/lib to your local machine.

     com.ibm.mq
     com.ibm.mq.commonservices

     com.ibm.mq.headers

     com.ibm.mq.jmqi
     com.ibm.mq.pcf
     com.ibm.mqjms
     connector
     dhbcore

  • Next open Hermes JMS and click configuration to setup new provider and classpath as shown in image below.
      
  • Goto providers tab and right click to add a new group. Provide some name like "WMQ7".
  • Now add all the jars to this group that we have copied from the Websphere MQ installation and click Ok.
  • Create a new session and select the provider we created in last step. Also select the connection factory class - com.ibm.mq.jms.MQQueueConnnectionFactory.
  • Add properties - hostname, port, queueManager, channel, transportType. TransportType value should be 1 if your are using TCP/IP for communication.
  • Select "IBMWebsphere MQ" in plug-in drop down. Click ok and you are done! Below image shows the fully configured session to Websphere MQ.



NOTE - Make sure that channel name is in ALL CAPS.

Error that I faced while configuring are -
  1. java.lang.NoClassDefFoundError: Could not initialize class com.ibm.mq.MQEnvironment
  2. hermes.browser.dialog.ConnectionFactoryConfigPanel - Could not initialize class com.ibm.mq.jms.MQQueueConnectionFactory
It all went away after adding the correct jars from the Websphere MQ installation folder.




51 comments:

  1. Thank you for the very clear tutorial.

    However, after adding the same .jar files as in your document, I'm still getting the 'Could not initialize class com.ibm.mq.jms.MQQueueConnectionFactory' error. Did you eventually add other .jar files or something?

    ReplyDelete
  2. Hi Lowie - This error is common and related to one of the missing jar. Possibly you have some different version of MQ. Check your MQ version and accordingly add all the required jars.

    ReplyDelete
  3. Hi, When I click on the drop down to select IBM WebSphereMQ I get a popup window stating "Unable to locate this plugin. Select the loader the JMS provider classes are in before choosing the plugin." I am not sure what that means or what to do next. Any ideas/suggestions?

    Thanks

    ReplyDelete
    Replies
    1. Wait, found a solution. You must first select the classpath group name, in the case above its WMQ7, from the drop down in the middle pane next to the 'Loader:' Then go back up to the first pane and select IBM WebSphereMQ under plugin.

      Delete
  4. This comment has been removed by the author.

    ReplyDelete
  5. This is the one with all the technical stuff relates to all techies....
    Websphere Training In Hyderabad

    ReplyDelete
  6. Hi,
    I have added the jar files and I can see com.ibm.mq in my configurations but still i am getting the exception.
    java.lang.NoClassDefFoundError: Could not initialize class com.ibm.mq.MQEnvironment

    Is there anywhere else where we need to add this

    ReplyDelete
  7. Newer versions also needs javax.resource-api

    ReplyDelete
  8. uykuk67uk 76kmktyk ghkghk urjj tykr iytktktyktkyktyk tktykseyk 6s gjnsk tuktytyk ytktyk ytkkytktyktyktktyk y]~ytç,mklnvlemkvlknelrvknev fuck !!!!

    ReplyDelete
  9. I am not able to see this option com.ibm.mq.jms.MQQueueConnectionFactory in connection Factory Option. Help me how to see this in Hermes

    ReplyDelete
  10. Hadoop training in hyderabad.All the basic and get the full knowledge of hadoop.
    hadoop training in hyderabad


    ReplyDelete
  11. Hi,

    I'm getting this error, "com.ibm.mq.MQException: MQJE001: An MQException occurred: Completion Code 2, Reason 2059 MQJE011: Socket connection attempt refused site:www.ibm.com" after configuring everything.But my Queues, Channel & Queue Manager are in remote machines...Kindly help on this...

    ReplyDelete
  12. In Hermes JMS, I am able to create a new session and connect to an instance of WebsphereMQ and discover all queues.

    The steps in brief are:
    1. Create a new session
    2. Add a Group in the Providers tab that has the WebSphere MQ jars.
    3. In Sessions tab, configure as in below screen shot.
    4. Select Session and Discover.


    However, it does not discover the Topics that are on the server.
    I've tried a fair amount of different configurations with no luck.

    ReplyDelete
  13. Hi Im getting below error any advice?

    com.ibm.mq.MQException: MQJE001: An MQException occurred: Completion Code 2, Reason 2009
    MQJE016: MQ queue manager closed channel immediately during connect
    Closure reason = 2009
    at com.ibm.mq.MQManagedConnectionJ11.(MQManagedConnectionJ11.java:212)
    at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:318)
    at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:338)
    at com.ibm.mq.StoredManagedConnection.(StoredManagedConnection.java:84)
    at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:168)
    at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:772)
    at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:697)
    at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:657)
    at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:153)
    at com.ibm.mq.MQQueueManager.(MQQueueManager.java:451)
    at hermes.ext.mq.MQSeriesAdmin.getQueueManager(MQSeriesAdmin.java:107)
    at hermes.ext.mq.MQSeriesAdmin.discoverDestinationConfigs(MQSeriesAdmin.java:280)
    at hermes.impl.HermesAdminAdapter.discoverDestinationConfigs(HermesAdminAdapter.java:82)
    at hermes.impl.DefaultHermesImpl.discoverDestinationConfigs(DefaultHermesImpl.java:1126)
    at hermes.browser.tasks.DiscoverDestinationsTask.invoke(DiscoverDestinationsTask.java:77)
    at hermes.browser.tasks.TaskSupport.run(TaskSupport.java:175)
    at hermes.browser.tasks.ThreadPool.run(ThreadPool.java:170)
    at java.lang.Thread.run(Unknown Source)
    Caused by: com.ibm.mqservices.MQInternalException: MQJE001: An MQException occurred: Completion Code 2, Reason 2009
    MQJE016: MQ queue manager closed channel immediately during connect
    Closure reason = 2009
    at com.ibm.mq.MQv6InternalCommunications.checkControlFlags(MQv6InternalCommunications.java:740)
    at com.ibm.mq.MQv6InternalCommunications.establishChannel(MQv6InternalCommunications.java:656)
    at com.ibm.mq.MQv6InternalCommunications.initialize(MQv6InternalCommunications.java:206)
    at com.ibm.mq.MQv6InternalCommunications.(MQv6InternalCommunications.java:102)
    at com.ibm.mq.MQSESSIONClient.MQCONNX(MQSESSIONClient.java:1337)
    at com.ibm.mq.MQSESSIONClient.MQCONN(MQSESSIONClient.java:1246)
    at com.ibm.mq.MQManagedConnectionJ11.(MQManagedConnectionJ11.java:184)
    ... 17 more

    ReplyDelete
  14. Create a channel and it will solve the problem. Let me know if you need help in creating the channel in queue manager

    ReplyDelete
  15. You are doing a great job. I would like to appreciate your work for good accuracy.
    Selenium Training Institute in chennai | Selenium Testing Training in Chennai

    ReplyDelete
  16. Really very happy to say, your post is very interesting to read. I never stop myself to say something about it. You’re doing a great job. Keep it up…

    Start your journey with Best SAP FICO Course and get hands-on Experience with 100% Placement assistance from experts Trainers @Softgen Infotech Located in BTM Layout Bangalore.

    ReplyDelete

Demystifying OIC, OCI and Oracle SOA CS

What is OIC (Oracle integration cloud), OCI (Oracle cloud infrastructure), and SOA cloud service and how they are different? - This has bee...