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
  • How can I determine that adapter create connection factory? My SonicMQ1 startet without any visible problems. But I don't like log SonicMQ start error: 

    Main >(Mar 24, 2017 16:53:48:606) : Reading jmsProvider.properties from location : C:\Program Files\OpenEdge\properties\jmsProvider.properties
    Main >: A public jmsfromABL.AdminObjectFinder class was not found.

    1526.sonicMQ1.server.log

  • Hello, Anand. Explain, please - I have a connection to the WebSphere MQ server on my database server (PASOE is running on this server too). I installed MQ Client 7.5 on my server. In the file C:\Program Files (x86)\IBM\WebSphere MQ\java\bin\JMSAdmin.config I have:

    INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory

    PROVIDER_URL=file:/C:/JNDI-Directory

    SECURITY_AUTHENTICATION=none

    Does this mean that the .binding file and the AdminObjectFinder.jar file should be in the server's directory C:\JNDI-Directory? Because now the AdminObjectFinder.jar file lies on server'd disk D in the folder D:\Depo101\DPRO_31_10\MQ.

    It seems to me that I made a mistake in the jar file or in JMS configuration...

    Here is java file and archive.

    AdminObjectFinder.java

    AdminObjectFinder.jar

    I set the log level to 5.

    6523.ubroker.properties

    6131.sonicMQ1.server.log

  • Hi Fuelfire,

    We can find the connection factory information in sonicMQ1.server.log as shown below:

    Main >======================================================================
    Main >(Mar 27, 2017 04:37:25:351) /largedisk/aadike/triage/linux64/117/4jptplongcharptp_WebsphereMQ.dir/sonicMQ1.server.log opened.
    Main >(Mar 27, 2017 04:37:25:351) : Starts Adapter server logging.
    Main >(Mar 27, 2017 04:37:25:351) : LoggingLevel set to = 5
    Main >(Mar 27, 2017 04:37:25:351) : The system property: sonicMQExtensions is set to false
    Main >(Mar 27, 2017 04:37:25:351) : The classpath is set to /view/rdl117_linuxx86_64/vobs_prgs/linuxx86_64/dlc/java/progress.jar:/largedisk/aadike/MQShared/java/lib/com.ibm.mqjms.jar:/largedisk/aadike/triage/linux64/117/4jptplongcharptp_WebsphereMQ.dir/AdminObjectFinder.jar
    Main >(Mar 27, 2017 04:37:25:390) : Reading jmsProvider.properties from location : /view/rdl117_linuxx86_64/vobs_prgs/linuxx86_64/dlc/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)

    From the log it seems AdminObjectFinder.class file is not available under jmsfromABL package in AdminObjectFinder.jar file.

    Follow the below steps to generate AdminObjectFinder.jar file

    Step 1: Add the following lines in AdminObjectFinder.java

    env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
    env.put(Context.PROVIDER_URL, "file://D:/Depo101/DPRO_31_10//MQ");
    env.put(Context.SECURITY_PRINCIPAL, "swiftmq");
    env.put(Context.SECURITY_CREDENTIALS, "swiftmq");

    Step 2: compile the java file using following command.
    javac -cp jms.jar:.: -d . AdminObjectFinder.java

    Step 3: Now, generate the jar file with below command.
    jav -cvf AdminObjectFinder.jar jmsfromABL

    Step 4: Place the generated jar file in classpath and pluginsclasspath in AdminServerPlugins.properties file.
    Step 5: Restart the AdminServer and sonicMQ1 broker.

    Please find the attached sample AdminObjectFinder.java.

    Hope this helps!!

    8551.AdminObjectFinder.java

    Thanks,
    Anand.

  • I can not download the file - page not found. From your answer I see that INITIAL_CONTEXT_FACTORY is changed: from "com.sun.jndi.fscontext.RefFSContextFactory" to "org.jnp.interfaces.NamingContextFactory".  And in PROVIDER_URL you use double slash after "file:" and before "MQ". I'll do it now. I'll keep you posted. Thank you for your help.

  • Anand, there are errors on step 2: package javax.jms does not exist.

    I used javac in %DLC%\jdk\bin. I run javac on my server.

    Last time I generated a class like this:

    javac D:\depo101\dpro_31_10\MQ\AdminObjectFinder.java

    Probably it's wrong..

  • Provide the fully qualified path for jms.jar file instead of absolute path. jms.jar file is available under <MQ_client_installation>/java/lib/jms.jar.

    javac -cp <MQ_client_installation>/java/lib/jms.jar -d . AdminObjectFinder.java.

    Thanks,

    Anand.

  • :-( I attached inappropriate screen. I have the same error with the full path:

    I used the following command:

    proenv>javac -cp C:\progra~2\IBM\WebSph~1\java\lib\jms.jar:.: -d . D:\Depo101\DPRO_31_10\MQ\AdminObjectFinder.java

  • In windows OS, we need to use semi-colon(;) when we are providing multiple jar file names in classpath. It should work if we replace semi-colon(;) with colon(:).

    Thanks,

    Anand.

  • It worked! I create AdminObjectFinder.jar.

    3225.AdminObjectFinder.jar

    When I restart AdminService (and restart SonicMQ1 too) I see this error in sonicmq1.server.log whatever:

    L-3620>(Mar 27, 2017 15:55:53:765) Log Closed
    Main  >======================================================================
    Main  >(Mar 27, 2017 15:57:42:665) D:\OpenEdge\WRK\sonicMQ1.server.log opened.
    Main  >(Mar 27, 2017 15:57:42:665) : Starts Adapter server logging.
    Main  >(Mar 27, 2017 15:57:42:665) : LoggingLevel set to = 5
    Main  >(Mar 27, 2017 15:57:42:665) : The system property: sonicMQExtensions is set to  false
    Main  >(Mar 27, 2017 15:57:42:666) : 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 27, 2017 15:57:42:675) : Reading jmsProvider.properties from location : C:\Program Files\OpenEdge\properties\jmsProvider.properties
    Main  >: A public jmsfromABL.AdminObjectFinder class was not found.
    S-0001>(Mar 27, 2017 15:59:47:285) 172.25.197.193::sonicMQ1::3620::b984647710b3e528:1d2fd2c7:15b0fd7ea62:-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 27, 2017 15:59:47:291) S-0001: receive message queue size set to 10
    S-0001>(Mar 27, 2017 15:59:47:294) S-0001: browse message queue size set to 500
    S-0001>(Mar 27, 2017 15:59:47:294) : In SessionContainer()
    S-0001>(Mar 27, 2017 15:59:47:294) : Looking up ConnectionFactory in JNDI Object Store
    S-0001>(Mar 27, 2017 15:59:47:294) : Connection Factory object not found in JNDI Object Store. Creating using jmsProvider.properties file
    S-0001>(Mar 27, 2017 15:59:47:294) : Creating JMS connection factory with Broker URL as [ UNIQM ]
    S-0001>(Mar 27, 2017 15:59:47:611) : Setting Queue Manager UNIQM on Connection Factory Class com.ibm.mq.jms.MQConnectionFactory
    S-0001>(Mar 27, 2017 15:59:47:616) 172.25.197.193::sonicMQ1::3620::b984647710b3e528:1d2fd2c7:15b0fd7ea62:-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 27, 2017 15:59:47:690) 172.25.197.193::sonicMQ1::3620::b984647710b3e528:1d2fd2c7:15b0fd7ea62:-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

    1. Anand, could you explain, please, why we should use

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

    instead

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

    It is suspicious that does not always use a double slash in the path to the directory (PROVIDER_URL). 

    I see that the documentation'example uses one slash:

    env.put(Context.PROVIDER_URL, "file:/C:/JNDI");

    2. I do not like the way to TAB in the bindings file:

    RemoteCF/RefAddr/112/Content=file\:D\:/Depo101/DPRO_31_10/MQ/AMQCLCHL.TAB

    Is it wrong path or it's Ok?

  • I tried to connect WebSphere MQ from the server and from workstation. The difference between this tests - description of recieving error.

    When I run program on the server I receive in the sonicmq.server.log:

    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]

    When I run program on the workstation I receive:

    Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2495;AMQ8568: The native JNI library 'mqjbnd' was not found. For a client installation this is expected. [3=mqjbnd]

    There is WebSphere MQ Client 7.5 in both cases.

    Could anyone tell me where I can downloaded mqjbnd64/mqjbnd library? Thanks.

  • Please find the attached samples.zip file that contains the following files:

    1) AdminObjectFinder.java

    2) .bindings

    3)  AMQCLCHL.TAB

    From the sonicMQ1.server.log seems that did not created the connection factory. Use the attached files from your reference.

    sample.zip

    Thanks,

    Anand.

  • Hi, Anand. I have to make changes to the files. I wrote in AdminObjectFinder.java:

    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory");
    env.put(Context.PROVIDER_URL, "file:D:\\Depo101\\DPRO_31_10\\MQ"); //works for remote client
    env.put(Context.SECURITY_PRINCIPAL, "swiftmq");
    env.put(Context.SECURITY_CREDENTIALS, "swiftmq");

    What should I change in a binding? Server name, port and path to tab? How correctly to specify a CCDT path in this file directly for Windows of environment? I found this description on the website of IBM:

    1. In the client channel definition table (CCDT) field, enter the explicit path to the file on the server in the form of a URL. For example, if the file was in this path, C:\mquser\ccdt\amqclchl.tab, then the URL for the CCDT field would be file://C:/mquser/ccdt/amqclchl.tab.

    Your .bindings file uses the paths for the Unix environment. In my case this is Windows.

    Accordingly, I must replace the path:

    RemoteTopicCF/RefAddr/53/Content=file\:/largedisk/aadike/triage/linux64/117/4jptplongcharptp_WebsphereMQ.dir/AMQCLCHL.TAB

    with:

    RemoteTopicCF/RefAddr/53/Content=file\://D\:/Depo101/DPRO_31_10/MQ/AMQCLCHL.TAB

    Is it correct?

    Our bindings files are different. There are lines like "RemoteCF/RefAddr/" In my generated file. Your file contains lines like "RemoteCF/RefAddr" and lines like "RemoteQueueCF/RefAddr" and lines like "RemoteTopicCF". 

    I got the binding file on my workstation via jmsAdmin.bat. Perhaps it should be generated on the server?

    In any case, I need to understand how to specify the path to the tab-file in .bindings.

  • Hi Fuelfire,

    In the .bindings file we need to provide the location of CCDT path. Below is example to specify CCDT file path in windows:

    .bindings

    RemoteCF/RefAddr/56/Content=file\:C\:/Progress/location/AMQCLCHL.TAB

    In my .bindings file I have three different connect factories that is the reason you are able to see multiple connection factories names like RemoteCF, RemoteTopicCF and RemoteQueueCF. I think in your case you might be having only on connection factory.

    Thanks,
    Anand.

  • I must use your tab file? I still left my AMQCLCHL.TAB.

    I copy modified AdminObjectFinder.java in D:\Depo101\DPRO_31_10\MQ on the server.

    Note how I specified the path to the directory:

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

    This directory (d:\depo101\DPRO_31_10\MQ) contains my AMQCLCHL.TAB and .bindings. Then I compiled java and packed it in jar (i use %dlc%\jdk\bin on the server):

    javac -cp C:\progra~2\IBM\WebSph~1\java\lib\jms.jar;.; -d . D:\Depo101\DPRO_31_10\MQ\AdminObjectFinder.java
    
    jar -cvf d:\depo101\DPRO_31_10\MQ\AdminObjectFinder.jar C:\Progra~1\OpenEdge\jdk\bin\jmsfromABL

    Here is the files:

    2063.AdminObjectFinder.java

    4130.AdminObjectFinder.jar

    Then I stoped AdminService on server and after a few minutes I started it. My sonicMQ1 adapter is configured to autostart:

    Then I check the sonicMQ1.server.log:

    Main >======================================================================
    Main >(Mar 28, 2017 14:19:14:599) D:\OpenEdge\WRK\sonicMQ1.server.log opened.
    Main >(Mar 28, 2017 14:19:14:599) : Starts Adapter server logging.
    Main >(Mar 28, 2017 14:19:14:599) : LoggingLevel set to = 5
    Main >(Mar 28, 2017 14:19:14:599) : The system property: sonicMQExtensions is set to false
    Main >(Mar 28, 2017 14:19:14:599) : 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 28, 2017 14:19:14:635) : Reading jmsProvider.properties from location : C:\Program Files\OpenEdge\properties\jmsProvider.properties
    Main >: A public jmsfromABL.AdminObjectFinder class was not found.

    Nothing changed!

    Do you see a mistake in my actions?

    I'll try to use your binding file now. I'm afraid to make a mistake when editing it. Anyway, I'll try. I'll keep you informed.

  • Anand, please check my program. May be my program is not good? And the reason is not in the configuration.

    test_put.p