Connect to WebSphere MQ through JMS API (JMS Adapter) - Forum - OpenEdge Development - Progress Community

Connect to WebSphere MQ through JMS API (JMS Adapter)

 Forum

Connect to WebSphere MQ through JMS API (JMS Adapter)

This question is answered

Hello, everybody! 

I'm trying to open, get, put, close WebSphere MQ queuе through JMS API. 

I want to connect to the queue manager, open a specific queue, put in her message, get the message and then close and disconnect. Earlier I connected to the MQ through MQ API

With the help of colleagues from this forum, I was able to write a program with the help of which I got the opportunity to put messages in the queue and pick them up. This program is very cumbersome. I made it in the OpenEdge 10.1B, using installed the WebSphere MQ client 7.5 and downloaded the manual "MQSeries Application Programming Interface". It was a test and this solution is not used in our product.

Now I'm using version 11.6.3. Having learned that since version 11.5.1 I can interact with WebSphere MQ without using the SonicMQ (I do not have licenses for this product), I became interested and decided to figure it out.

My task of interacting with WebSphere MQ queues is complicated by the fact that I have to access the queue from the server (not from the client, as in the program I wrote earlier). For these purposes, I plan to use purchased and installed on the database server PAS for OE. In any case, this is how I call the web services: the program on the client calls the application server on which the service call programs run.

So, I started to study the documentation "Messaging and ESB". I made the necessary changes in jmsProvider.properties and AdminServerPlugins.properties in In the %DLC%\properties path:

[PluginPolicy.Progress.SonicMQ]
    pluginclasspath=C:\Program Files\Progress\OpenEdge_11_6/sonic/MQ8.5/lib/sonic_Client.jar,C:\Program Files\Progress\OpenEdge_11_6/sonic/MQ8.5/lib/mgmt_client.jar,C:\Program Files\Progress\OpenEdge_11_6/java/progress.jar,C:\PROGRA~1\IBM\WEBSPH~1\java\lib\com.ibm.mqjms.jar
    classpath=C:\Program Files\Progress\OpenEdge_11_6/sonic/MQ8.5/lib/sonic_Client.jar,C:\Program Files\Progress\OpenEdge_11_6/java/progress.jar,C:\PROGRA~1\IBM\WEBSPH~1\java\lib\com.ibm.mqjms.jar
    jvmargs=-DsonicMQExtensions=false -DjmsProvider=WebSphereMQ

After that, I began to doubt: there is a WebSphere client on my workstation. But our users work with software using the Client Networking, hosted on a network resource. Probably I should install the WebSphere client on the network? After all, I must somehow run the SonicMQ adapter? On the server in Progress OpenEdge Management I chose the SonicMQ Adapter Resource. But nothing can be created here. Here I am stuck. Do I need to configure something on the server or just make changes to the properties files? Maybe I missed something (did not install it) during the installation of OpenEdge RDBMS?

Can anyone help me? Thanks.

Andrew.

All Replies
  • Could you please share the below updated files:

    1) AdminServerPlugnis.properties

    2) jmsProvider.proerties

    3) AdminObjectFinder.java

    4) AMQCLCHL.TAB

    5) .bindings

    6) Procedures that you are using to publish/consume the messages.

    Thanks,

    Anand.

  • Ok.

    0334.Archive.rar

    AdminObjectFinder.java, AdminObjectFinder.jar, AMQCLCHL.TAB and .bindings files are located in D:\Depo101\DPRO_31_10\MQ:

    My program that put message in query is test_put.p.

  • Anand, I generated the .binding file on your tab-file. I copied 2 files in the server's directory D:\Depo101\DPRO_31_10\MQ, but  there is the same result:

    A public jmsfromABL.AdminObjectFinder class was not found.

    S-0001>(Mar 28, 2017 17:37:53:787) : Looking up ConnectionFactory in JNDI Object Store
    S-0001>(Mar 28, 2017 17:37:53:788) : Connection Factory object not found in JNDI Object Store. Creating using jmsProvider.properties file
    S-0001>(Mar 28, 2017 17:37:53:788) : Creating JMS connection factory with Broker URL as [ UNIQM ]

    I don't know what's wrong... :-(

  • Hi, Anand!

    I do not remember if I rebooted the server after installing the MQ Client. I restarted it in the morning. Then I recreated the AdminObjecttFinder.jar (jmsfromABL directory was created in D:\Depo101\DPRO_31_10\MQ). Without a good result. The error is the same.

    I think my AdminObjectFinder.jar is not correct. Look here, please:

    It seems to me that in the jar there must be a directory "jmsfromABL" without absolute path... Can you attach any AdminObjectFinder.jar? 

  • It seems to be better already :-) I compiled and packed this way:

    That's what's in the log when sonicMQ1 starts:

    Main  >======================================================================
    Main  >(Mar 29, 2017 10:47:35:091) D:\OpenEdge\WRK\sonicMQ1.server.log opened.
    Main  >(Mar 29, 2017 10:47:35:091) : Starts Adapter server logging.
    Main  >(Mar 29, 2017 10:47:35:091) : LoggingLevel set to = 5
    Main  >(Mar 29, 2017 10:47:35:091) : The system property: sonicMQExtensions is set to  false
    Main  >(Mar 29, 2017 10:47:35:091) : The classpath is set to  C:\Program Files\OpenEdge\java\progress.jar;C:\PROGRA~2\IBM\WEBSPH~1\java\lib\com.ibm.mqjms.jar;D:\Depo101\DPRO_31_10\MQ\AdminObjectFinder.jar
    Main  >(Mar 29, 2017 10:47:35:124) : Reading jmsProvider.properties from location : C:\Program Files\OpenEdge\properties\jmsProvider.properties
    Main  >: The AdminObjectFinder.getTopicConnectionFactory method is used for finding the TopicConnectionFactory object. (9301)
    Main  >: The AdminObjectFinder.getQueueConnectionFactory method is used for finding the QueueConnectionFactory object. (9303)
    Main  >: The AdminObjectFinder.getTopic method is used for finding the Topic objects. (9305)
    Main  >: The AdminObjectFinder.getQueue method is used for finding the Queue objects. (9307)

    But when I start test_put.p Ireceive:

    S-0001>(Mar 29, 2017 10:51:37:538) 172.25.197.193::sonicMQ1::3620::fd5fb9d0e955d13d:2a8ce8b1:15b1908b614:-7fec:     Startup Parameters:
        jmsServerName: 
        Point-To-Point     
        brokerURL: UNIQM
        user: swiftmq
        password: swiftmq
        clientID: null
        pingInterval: 
        transactedPublish: false
        transactedReceive: false
        singleMessageAck: false
        symbiontAdapter: false
        jmsDomain: true
    
    S-0001>(Mar 29, 2017 10:51:37:543) S-0001: receive message queue size set to 10
    S-0001>(Mar 29, 2017 10:51:37:545) S-0001: browse message queue size set to 500
    S-0001>(Mar 29, 2017 10:51:37:546) : In SessionContainer()
    S-0001>: Connection factory with the name UNIQM not found in JNDI store. Printing stack trace: 
    S-0001>
    java.lang.reflect.InvocationTargetException
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:606)
    	at com.progress.messaging.jms.jms.getConnFactory(jms.java:516)
    	at com.progress.messaging.jms.jms._connect(jms.java:240)
    	at com.progress.javafrom4gl.implementation.JavaServlet.<init>(JavaServlet.java:81)
    	at com.progress.javafrom4gl.implementation.ServiceImpl.createConnectionServlet(ServiceImpl.java:106)
    	at com.progress.ubroker.broker.ubServerThreadIPC.write(ubServerThreadIPC.java:432)
    	at com.progress.ubroker.broker.ubASserverThread.processConnect(ubASserverThread.java:574)
    	at com.progress.ubroker.broker.ubServerThread.processEvent(ubServerThread.java:1210)
    	at com.progress.ubroker.broker.ubServerThread.mainline(ubServerThread.java:479)
    	at com.progress.ubroker.broker.ubServerThread.run(ubServerThread.java:356)
    Caused by: javax.naming.NameNotFoundException: UNIQM
    	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 javax.naming.InitialContext.lookup(InitialContext.java:411)
    	at jmsfromABL.AdminObjectFinder.getConnectionFactory(AdminObjectFinder.java:45)
    	... 13 more
    S-0001>(Mar 29, 2017 10:51:37:553) : Looking up ConnectionFactory in JNDI Object Store
    S-0001>(Mar 29, 2017 10:51:37:553) : Connection Factory object not found in JNDI Object Store. Creating using jmsProvider.properties file
    S-0001>(Mar 29, 2017 10:51:37:553) : Creating JMS connection factory with Broker URL as [ UNIQM ]
    S-0001>(Mar 29, 2017 10:51:37:937) : Setting Queue Manager UNIQM on Connection Factory Class com.ibm.mq.jms.MQConnectionFactory
    S-0001>(Mar 29, 2017 10:51:37:942) 172.25.197.193::sonicMQ1::3620::fd5fb9d0e955d13d:2a8ce8b1:15b1908b614:-7fec: Using connection values: 26,null,true,,true,false,-1,-1,false,0,false,false,,10000,0,30,false,60,0,20,0,,swiftmq,swiftmq,depotest2,localhost
    S-0001>(Mar 29, 2017 10:51:38:016) 172.25.197.193::sonicMQ1::3620::fd5fb9d0e955d13d:2a8ce8b1:15b1908b614:-7fec
    com.ibm.msg.client.jms.DetailedJMSException: JMSFMQ6312: An exception occurred in the Java(tm) MQI.
    The Java(tm) MQI has thrown an exception describing the problem. 
    See the linked exception for further information.
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    	at com.ibm.msg.client.commonservices.j2se.NLSServices.createException(NLSServices.java:319)
    	at com.ibm.msg.client.commonservices.nls.NLSServices.createException(NLSServices.java:233)
    	at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:6863)
    	at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:6254)
    	at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConnection(JmsConnectionFactoryImpl.java:285)
    	at com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConnectionFactory.java:6189)
    	at com.ibm.mq.jms.MQConnectionFactory.createConnection(MQConnectionFactory.java:6245)
    	at com.progress.messaging.jms.SessionContainer.createConnection(SessionContainer.java:1512)
    	at com.progress.messaging.jms.SessionContainer.init(SessionContainer.java:303)
    	at com.progress.messaging.jms.JmsConnection.<init>(JmsConnection.java:39)
    	at com.progress.messaging.jms.jms._connect(jms.java:279)
    	at com.progress.javafrom4gl.implementation.JavaServlet.<init>(JavaServlet.java:81)
    	at com.progress.javafrom4gl.implementation.ServiceImpl.createConnectionServlet(ServiceImpl.java:106)
    	at com.progress.ubroker.broker.ubServerThreadIPC.write(ubServerThreadIPC.java:432)
    	at com.progress.ubroker.broker.ubASserverThread.processConnect(ubASserverThread.java:574)
    	at com.progress.ubroker.broker.ubServerThread.processEvent(ubServerThread.java:1210)
    	at com.progress.ubroker.broker.ubServerThread.mainline(ubServerThread.java:479)
    	at com.progress.ubroker.broker.ubServerThread.run(ubServerThread.java:356)
    Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2495;AMQ8568: The native JNI library 'mqjbnd64' was not found. For a client installation this is expected. [3=mqjbnd64]
    	at com.ibm.mq.jmqi.local.LocalMQ$1.run(LocalMQ.java:315)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at com.ibm.mq.jmqi.local.LocalMQ.initialise_inner(LocalMQ.java:279)
    	at com.ibm.mq.jmqi.local.LocalMQ.initialise(LocalMQ.java:242)
    	at com.ibm.mq.jmqi.local.LocalMQ.<init>(LocalMQ.java:1205)
    	at com.ibm.mq.jmqi.local.LocalServer.<init>(LocalServer.java:206)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    	at com.ibm.mq.jmqi.JmqiEnvironment.getInstance(JmqiEnvironment.java:738)
    	at com.ibm.mq.jmqi.JmqiEnvironment.getMQI(JmqiEnvironment.java:672)
    	at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:6855)
    	... 15 more
    Caused by: java.lang.UnsatisfiedLinkError: no mqjbnd64 in java.library.path
    	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
    	at java.lang.Runtime.loadLibrary0(Runtime.java:849)
    	at java.lang.System.loadLibrary(System.java:1088)
    	at com.ibm.mq.jmqi.local.LocalMQ.loadLib(LocalMQ.java:1149)
    	at com.ibm.mq.jmqi.local.LocalMQ$1.run(LocalMQ.java:290)
    	... 27 more
    
  • Just in case, I'll attach a screenshot with the commands that make the correct jar (directory "1" contains only directory "jmsfromABL").

  • I read the error "Connection factory with the name UNIQM not found in JNDI store". I replace this line in program:

    RUN setBrokerURL IN ptpsession (INPUT QueueManager).

    with:

    RUN setBrokerURL IN ptpsession ("RemoteCF").

    I gor another error when I run test_put.p:

    S-0003>(Mar 29, 2017 11:45:23:669) 172.25.197.193::sonicMQ1::3620::a67accc527088e3b:4fc2a024:15b19242fe1:-7fc4:     Startup Parameters:
        jmsServerName: 
        Point-To-Point     
        brokerURL: RemoteCF
        user: swiftmq
        password: swiftmq
        clientID: null
        pingInterval: 
        transactedPublish: false
        transactedReceive: false
        singleMessageAck: false
        symbiontAdapter: false
        jmsDomain: true
    
    S-0003>(Mar 29, 2017 11:45:23:669) S-0003: receive message queue size set to 10
    S-0003>(Mar 29, 2017 11:45:23:670) S-0003: browse message queue size set to 500
    S-0003>(Mar 29, 2017 11:45:23:670) : In SessionContainer()
    S-0003>(Mar 29, 2017 11:45:23:685) : Looking up ConnectionFactory in JNDI Object Store
    S-0003>(Mar 29, 2017 11:45:23:685) 172.25.197.193::sonicMQ1::3620::a67accc527088e3b:4fc2a024:15b19242fe1:-7fc4: Using connection values: 26,null,true,,true,false,-1,-1,false,0,false,false,,10000,0,30,false,60,0,20,0,,swiftmq,swiftmq,depotest2,localhost
    S-0003>(Mar 29, 2017 11:45:23:925) 172.25.197.193::sonicMQ1::3620::a67accc527088e3b:4fc2a024:15b19242fe1:-7fc4
    com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ2020: Failed to connect to queue manager 'UNIQM' with connection mode 'Client' and supplied CCDT URL 'file:D:/Depo101/DPRO_31_10/MQ/AMQCLCHL.TAB', see linked exception for more information.
    Check the queue manager is started and if running in client mode, check there is a listener running. Please see the linked exception for more information.
    	at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:585)
    	at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:221)
    	at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:327)
    	at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:6876)
    	at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:6254)
    	at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConnection(JmsConnectionFactoryImpl.java:285)
    	at com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConnectionFactory.java:6189)
    	at com.ibm.mq.jms.MQConnectionFactory.createConnection(MQConnectionFactory.java:6245)
    	at com.progress.messaging.jms.SessionContainer.createConnection(SessionContainer.java:1512)
    	at com.progress.messaging.jms.SessionContainer.init(SessionContainer.java:303)
    	at com.progress.messaging.jms.JmsConnection.<init>(JmsConnection.java:39)
    	at com.progress.messaging.jms.jms._connect(jms.java:279)
    	at com.progress.javafrom4gl.implementation.JavaServlet.<init>(JavaServlet.java:81)
    	at com.progress.javafrom4gl.implementation.ServiceImpl.createConnectionServlet(ServiceImpl.java:106)
    	at com.progress.ubroker.broker.ubServerThreadIPC.write(ubServerThreadIPC.java:432)
    	at com.progress.ubroker.broker.ubASserverThread.processConnect(ubASserverThread.java:574)
    	at com.progress.ubroker.broker.ubServerThread.processEvent(ubServerThread.java:1210)
    	at com.progress.ubroker.broker.ubServerThread.mainline(ubServerThread.java:479)
    	at com.progress.ubroker.broker.ubServerThread.run(ubServerThread.java:356)
    Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2423' ('MQRC_CLIENT_CHANNEL_CONFLICT').
    	at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:209)
    	... 17 more
    

    May be I must exclude "CHAN(SWIFTMQ.SVRCONN)" from define command when I generate .bindings?

  • Hi Fuelfire,

    Thank you for sharing the files.

    Looked at the files and observed that the jar (AdminObjectFinder.jar)  that you are using is an invalid jar file. Please find the attached sample AdminObjectFinder.java and AdminObjectFinder.jar for your reference.

    Also, observed that you are using PTP domain from ABL client to publish the messages. What type of connection factory have you created in IBM WebSphereMQ?

    samples.zip


    Thanks,
    Anand.

  • Hi, Anand. Glad to see you on the forum. As for the creation of the jar file, it's now clear to me. I somewhere downloaded AdminObjectFinder with the class jmsfrom4GL and saw that the contents of the archive are different.

    Now about the Connection Factory. When I asked the administrator of the MQ what connection factory name I used for Define command, he told me that this name is given arbitrarily. That's why I used, as in your example, RemoteCF. Probably this parameter is set on the MQ server and the admin should tell me its name? Thanks!

  • Carefully read your question again. My define command is:

    DEF CF(RemoteCF) + QMGR(UNIQM) + TRAN(CLIENT) + CHAN(SWIFTMQ.SVRCONN) + HOST(vplmq12) + PORT(1422) + CCDTURL(file:D:/Depo101/DPRO_31_10/MQ/AMQCLCHL.TAB)

    What I should to do and where? (MQ client, MQ server).

  • Sending the name of the connection factory (RemoteCF) to the setBrokerURL I avoid the error:

    Connection factory with the name UNIQM not found in JNDI store

    But I get another error:

    JMSWMQ2020: Failed to connect to queue manager 'UNIQM' with connection mode 'Client' and supplied CCDT URL 'file:D:/Depo101/DPRO_31_10/MQ/AMQCLCHL.TAB', see linked exception for more information.

    ...

    Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2423' ('MQRC_CLIENT_CHANNEL_CONFLICT').

    What should I pass into the procedure setBrokerURL: the name of the connection factory or the name of the queue manager?

  • When we are creating connection factory in WebSphereMQ server there is an option to select which model we are going to use to send messages with created connection factory like PTP or Pub-Sub or any one these. If we create ptp connection factory then we need to use ptp domain in ABL and similary for pub-sub. In case, connection factory created to use both ptp and pub-sub then we have to use jms domain in ABL client.

    did you try to use the AdminObjectFinder.jar that i shared with you? if not please try to use it once. As i modified PROVIDER_URL in AdminObjectFinder.java.

    Thanks,

    Anand.

  • Sorry, I did not see that you corrected the file and found that they are the same. I replaced the jar file on the server, restarted AdminService and see the sonicMQ1.server.log:

    Main  >======================================================================
    Main  >(Mar 30, 2017 12:00:26:649) D:\OpenEdge\WRK\sonicMQ1.server.log opened.
    Main  >(Mar 30, 2017 12:00:26:649) : Starts Adapter server logging.
    Main  >(Mar 30, 2017 12:00:26:649) : LoggingLevel set to = 5
    Main  >(Mar 30, 2017 12:00:26:649) : The system property: sonicMQExtensions is set to  false
    Main  >(Mar 30, 2017 12:00:26:649) : The classpath is set to  C:\Program Files\OpenEdge\java\progress.jar;C:\PROGRA~2\IBM\WEBSPH~1\java\lib\com.ibm.mqjms.jar;D:\Depo101\DPRO_31_10\MQ\AdminObjectFinder.jar
    Main  >(Mar 30, 2017 12:00:26:692) : Reading jmsProvider.properties from location : C:\Program Files\OpenEdge\properties\jmsProvider.properties
    Main  >: A public jmsfromABL.AdminObjectFinder class was not found.
    

    Again, the old error.

  • replace the following line in AdminObjectFinder.java file and regenerate the jar file.

    from:

    env.put(Context.PROVIDER_URL, "file:D:\\Depo101\\DPRO_31_10\\MQ");

    to:

    env.put(Context.PROVIDER_URL, "file:/D:\\Depo101\\DPRO_31_10\\MQ");

    Thanks,

    Anand.

  • Compiled and packed your file myself and re-started the service AdminService again. There is no error after service starting. What should I pass to SetBrokerURL: queue manager name or connection factory name? When I passed queue manager name UNIQM i receive old error. I changed the line in program with

    RUN setBrokerURL IN ptpsession ("RemoteCF").

    and run. There are the same errors, which  I have already described to you. I attached the log.

    1460.sonicMQ1.server.log