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.

Verified Answer
  • pcode.zip
    Hi Fuelfire,
     
    Following are the two ways to connect IBM WebSphere MQ.
    • Local Queue Manager
    • Remote Queue Manager (using JNDI approach)
     
    Procedure to setup Local Queue Manager:
     
    Step 1: Need to update the WebSphereMQ connection factory class names in $DLC/properties/jmsProvider.propeties as shown below:
     
    [WebsphereMQ]
    javax.jms.ConnectionFactory=com.ibm.mq.jms.MQConnectionFactory
    javax.jms.QueueConnectionFactory=com.ibm.mq.jms.MQQueueConnectionFactory
    javax.jms.TopicConnectionFactory=com.ibm.mq.jms.MQTopicConnectionFactory
     
    Step 2: Update $DLC/properties/AdminServerPlugins.propertes file with WebSphereMQ libraries under [PluginPolicy.Progress.SonicMQ] section as shown below.
     
    [PluginPolicy.Progress.SonicMQ]
    pluginclasspath=C:\Progress115\OpenEdge/java/progress.jar,C:\PROGRA~2\IBM\WEBSPH~1\java\lib\com.ibm.mqjms.jar
    classpath=C:\Progress115\OpenEdge/java/progress.jar,C:\PROGRA~2\IBM\WEBSPH~1\java\lib\com.ibm.mqjms.jar
    jvmargs=-DsonicMQExtensions=false -DjmsProvider=WebSphereMQ
     
    Step 3: We need to start SonicMQ adapter with following command from proenv section.
                   proenv>adaptman -i sonicMQ1 -start
    Step 4: Provide the quque manager name as a value in Broker-URL in pcode and run it.
     
    Procedure to setup Remote Queue Manager:
     
    We need to follow below one extra step to connect WebSphere MQ remotely.
     
    Develop AdminObjectFinder.java by specifying PROVIDER_URL and generate jar out of it and place it in pluginclasspath and classpath under [PluginPolicy.Progress.SonicMQ].
     
    Please find the attached sample pcode.
     
    Thanks,
    Anand.
     
All Replies
  • I plan to work with the MQ through the PAS server.

    I wrote a test program that calls the PAS and runs a program on it that writes to the queue and reads from the queue. When I try to write a message to the queue, my program does not respond and in the log I see the following:

    [17/03/24@11:32:56.959+0300] P-003524 T-C-0001 2 UB Basic      The client requested ASK version= 1.0  capabilities= denyClientASK,allowServerASK. (13769)
    [17/03/24@11:32:56.959+0300] P-003524 T-C-0001 2 UB Basic      The negotiated ASK version= 1.0  capabilities= denyServerASK,denyClientASK.  ASK protocol is disabled for this connection. (15256)
    [17/03/24@11:32:56.983+0300] P-003524 T-C-0001 2 UB Basic      Client disconnected : 172.25.197.193. (8534)

    I found SonicMQ1 in OEM. I looked up an article in the knowledge base. And in one of them it is said that this is not a error.

    I correctly assume that the port selected on the snapshot is the port that I should use in the program. And do I need to change the "AppServer KeepAlive" property?

  • Hi, Srinivas! Thank you so much!

  • Ok. To make sure that the programs for working with the MQ work correctly, I created a program on the server (this is the database server, the PAS is running here, here SonicMQ1 is launched) and launched it.

    /* ***************************  Main Block  *************************** */
    DEFINE VARIABLE QueueManager AS CHAR NO-UNDO.
    DEFINE VARIABLE QueueName AS CHAR NO-UNDO.
    DEFINE VARIABLE CMessage AS CHAR NO-UNDO.
    
    ASSIGN QueueManager = "UNIQM"
                    QueueName = "TEST.Q"
                    CMessage = "Hello from DepoNet!!!".
    
    DEFINE VARIABLE ptpsession AS HANDLE.
    DEFINE VARIABLE messageH AS HANDLE.
    DEFINE VARIABLE lDebug AS LOGICAL.
    
    /* Creates a session object. */
    RUN jms/jmssession.p PERSISTENT SET ptpsession ("-H localhost -S 3620 -AppService AD.sonicMQ1"). 
    
    /* Set user credentials. */
     
    RUN setBrokerURL      IN ptpsession (INPUT QueueManager).
    
    /* Connect to the broker. */
    RUN beginSession IN ptpsession.
    
    /* Create a text message */
    RUN createTextMessage IN ptpsession (OUTPUT messageH).
    
    RUN setText IN messageH (CMessage).
    
    /* Publish the message on the "REQUEST" topic */
    RUN sendToQueue IN ptpsession (QueueName, messageH, ?, ?, ?).   
    RUN deleteMessage IN messageH.
    RUN deleteSession IN ptpsession.
    
    MESSAGE "SENT!" VIEW-AS ALERT-BOX.
    RETURN "0".
    

    I get the following:

    What's wrong?

  • You need to provide "-DirectConnect" parameter in the RUN method as shown below:

    RUN jms/jmssession.p PERSISTENT SET ptpsession ("-H localhost -S 3620 -AppService AD.sonicMQ1 -DirectConnect").

    Otherwise, it tries to connect to the NameServer using the port provided using "-S" parameter

  • Thanks, Srinivas. Connection error is gone. Now an error occurs while executing "RUN beginSession IN ptpsession.". Error text: Error connect to the JMS AppServer service.

    I'm trying to find a solution in Google.

  • Perhaps in [PluginPolicy.Progress.SonicMQ] I must specify the path to WebSphereMQ to lib64 if the interaction with the MQ occurs on the server?

    At the moment this section contains the following paths:

    [PluginPolicy.Progress.SonicMQ]
        pluginclasspath=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
        classpath=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
        jvmargs=-DsonicMQExtensions=false -DjmsProvider=WebSphereMQ
  • Hi Fuelfire,

    If sonicMQ1 started properly then we can find sonicMQ1 service name when we query the nameserver from proenv as shown below.

    proenv>nsman -i NS1 -q

    This will show whether sonicMQ1 is registered with nameserver or not.

    Also, we can find sonicMQ1 port number by executing the following command from proenv section.

    proenv>adaptman -i sonicMQ1 -q

    We can see the value of "Broker Port" in the result.

    If sonicMQ1 is not started then check the sonicMQ1 log files or share the files with us.

    Thanks,
    Anand.

  • Hi Fuelfire,

    Could you please share the following  files.

    1) $DLC/properties/AdminServerPlugins.properties

    2) $DLC/properties/ubroker.properties

    3) $DLC/properties/jmsProvider.properties

    4) $WRKDIR/sonicMQ1.server.log

    5) $WRKDIR/sonicMQ1.broker.log

    6) Procedures that you are using to send messages to the queue.

    Thanks,

    Anand.

  • Hi, Anand! Of Course! I found a topic where you explain how to set server logging level to 5. I did the same. I started SonicMQ adapter, executed the procedure to connect WebSphereMQ (I do this on the server to exclude the the PAS level). And I see in server log that " A public jmsfromABL.AdminObjectFinder class was not found."

    I do not understand what I did wrong?

    5554.Archive.rar

  • In my opinion, I understood the problem. In AdminObjectFinder.java i wrote:

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

    Disk J is the disk on my workstation (a shared folder on the disk D of server).

    If the script is running on a server, I should write:

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

    Perhaps this is the problem?

  • I checked my guess. Anyway, when I start SonicMQ1, I see a line in the server log:

    Main  >(Mar 24, 2017 13:50:42:662) : Reading jmsProvider.properties from location : C:\Program Files\OpenEdge\properties\jmsProvider.properties
    Main  >: A public jmsfromABL.AdminObjectFinder class was not found.
    
  • seems AdminObjectFinder.jar file not available in the specified location in classpath and pluginsclasspath in $DLC/properties/AdminServerPlugins.properties. Could you please check the location of jar file and also increase the server logging level to 5 for sonicMQ1 in $DLC/properties/ubroker.properties file.

    Thanks,

    Anand.

  • During this time I did the following:

    1. Change AdminObjectFinder.java 

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

    Now, I have 2 forward slashes "//" after "file:"

    2. Create and pack the class.

    My AdminObjectFinder.jar is located at D:\Depo101\DPRO_31_10\MQ:

    It's location on the server. On this server I run the program test_put.p

    The logging level is already increased. I've attached the log with an increased level.

    I see this log error: AMQ8568: The native JNI library 'mqjbnd64' was not found. For a client installation this is expected.

  • Anand, is it possible to handle exceptions if I call a program through an application server? I cann't get the error "Error connecting to the JMS AppServer service." when I run program test_q.p on workstation and put.p is executed on server by PASOE. Мy test_q.p hangs.

    5228.test_q.p

    1018.Put.p

  • Hi Fuelfire,

    Are you able to start the sonicMQ1 adapter without any problem? could you please let me know whether the adapter created the connection factory?

    Please share the sonicMQ1 log file with logging level 5.

    Thanks,

    Anand.