Author |
Message
|
pjramana |
Posted: Tue Mar 16, 2004 3:00 pm Post subject: Conecting Remote Qmanager thru base Java MQ. |
|
|
Novice
Joined: 08 Mar 2004 Posts: 14
|
Can somebody please provide me a solution for the problem below.
I have two Queue managers QMGR1 on box1 and QMGR2. on box2. Both are in cluster called DEV/CLUS.
QMGR1 has a local queue called REPLY.QUEUE.
QMGR2 has a local queue called REQUEST.QUEUE.
Now a java process has to put a Message to REQUEST.QUEUE, with MQMessage.replyQueue=REPLY.QUEUE ( local queue on QMGR1). Once the message is processed, the same java process tries to read the response from the REPLY.QUEUE, which is used by the process that reads REQUEST.QUEUE and sends response on REPLY.QUEUE.
The java process that writes into REQUEST.QUEUE is on box1 with QMGR1.
The problem i am having is, when i try to create a MQManager object for QMGR2, i am getting the error
com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2058
at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:246)
at com.ibm.mq.MQBindingsManagedConnectionFactoryJ11._createManagedConnection(MQBindingsManagedConnec
tionFactoryJ11.java:153)
at com.ibm.mq.MQBindingsManagedConnectionFactoryJ11.createManagedConnection(MQBindingsManagedConnect
ionFactoryJ11.java:189)
at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:80)
at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:171)
at com.ibm.mq.MQQueueManager.obtainBaseMQQueueManager(MQQueueManager.java:737)
at com.ibm.mq.MQQueueManager.construct(MQQueueManager.java:671)
at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:400)
PS : The queueManager names i am using are Correct. and the MQEnvironment i am setting is as follows.
MQEnvironment.properties.put( MQC.TRANSPORT_PROPERTY , MQC.TRANSPORT_MQSERIES);
MQEnvironment.hostname=null;
MQEnvironment.channel= TO.NMPEB3K1.00
-Thanks,
Janaki. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Mar 16, 2004 3:04 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You are not fully specifying all of the information you need to in order to make a client (remote) connection.
Code: |
MQEnvironment.hostname=null;
MQEnvironment.channel= TO.NMPEB3K1.00
|
This is only correct for a connection to a local queue manager.
If you want to use a local queue manager to talk to a remote queue manager, you have to use either Clustered queues or Remote Queue definitions. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
pjramana |
Posted: Tue Mar 16, 2004 8:13 pm Post subject: |
|
|
Novice
Joined: 08 Mar 2004 Posts: 14
|
Yes i am using local queue manager. The queues are set up like this.
QMGR1 --- LOCAL_QUEUE_1 -- QALIAS_FOR_LOCALQUEUE_1 -- AIX Box
QMGR2 --- LOCAL_QUEUE_2 -- QALIAS_FOR_LOCALQUEUE_2 -- Solaris Box
And both the QALIASES are in same cluster.
My java process has to put a request in QALIAS_FOR_LOCALQUEUE_2 from QMGR1(Aix Box). And the message will have replyToQueue= QALIAS_FOR_LOCALQUEUE_1, and that is where i the same java process reads the response for the message sent.
I tried fill Environment.hostname=Solaris box Name, still i am getting the error. If the hostname is null, then the program works for LOCAL queues and LOCAL queuemanager.
Thanks,
Janaki. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Mar 16, 2004 8:27 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
What machine is your java process running on?
What machine holds the queue manager that you want your java process to connect to?
If you want to make a connection from a java process running on one machine to a queue manager running on another machine, then you have to make a client connection. You need to supply MORE than just the hostname to MQEnvironment to make a client connection.
There's an entire manual called 'Clients'. The Using Java manual has specific examples of making client connections. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
pjramana |
Posted: Tue Mar 16, 2004 8:38 pm Post subject: |
|
|
Novice
Joined: 08 Mar 2004 Posts: 14
|
Hi Jefflowrey:
Thanks for the replies.
My java process runs on the box with AIX on it with QMGR1 in the example given. I was thinking that we do Client connections when there is no QueueManager on one of the boxes. In that case, the process uses Client Connections to connect the QueueManager on a different box. Is that different from the Client connections you are refering to?
In my cases, both the boxes have QManagers with qaliases in same cluster.
Thanks,
Janaki. |
|
Back to top |
|
 |
gunter |
Posted: Wed Mar 17, 2004 12:53 am Post subject: |
|
|
Partisan
Joined: 21 Jan 2004 Posts: 307 Location: Germany, Frankfurt
|
Why you'd like to create MQManager for QMGR2?
Use a MQManager for QMGR1. Even if the queue REQUEST.QUEUE is on QMGR2, you can put a message to it, there isn't an extra MQManager for QMGR2 nessesary. It the application is on box1, it can write REPLY.QUEUE and read REPLY.QUEUE with the same MQManager. |
|
Back to top |
|
 |
pjramana |
Posted: Wed Mar 17, 2004 8:41 am Post subject: |
|
|
Novice
Joined: 08 Mar 2004 Posts: 14
|
Now i tried with just the QMGR1, and i am trying to access the REQUEST.QUEUE which is plysically on QMGR2, but is in cluster, i am getting error
MQJE001: Completion Code 2, Reason 2085
Whisi is UNKNOW_OBJECT_NAME.
Both QMGR1 and QMGR2 are pointing to a repository box called QMGR3
and QMGR1 has a Sender Channel to QMGR3.
How can i access the REQUEST.QUEUE?
Thanks,
Janaki. |
|
Back to top |
|
 |
gunter |
Posted: Wed Mar 17, 2004 10:24 am Post subject: |
|
|
Partisan
Joined: 21 Jan 2004 Posts: 307 Location: Germany, Frankfurt
|
Is your cluster ok?
start runmqsc and check:dis qcluster(*)
dis clusqmgr(*)
In a cluster, you can put messages to all cluster queues, you can only read messages from local queues. |
|
Back to top |
|
 |
EddieA |
Posted: Wed Mar 17, 2004 10:40 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Note taken from the Java manual:
Quote: |
When sending a message to a cluster, leave the Queue Manager field in the JMS Queue object blank. This enables an MQOPEN to be performed in BIND_NOT_FIXED mode, which allows the queue manager to be determined. Otherwise an exception is returned reporting that the queue object cannot be found. This applies when using JNDI or defining queues at runtime |
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
pjramana |
Posted: Wed Mar 17, 2004 10:44 am Post subject: |
|
|
Novice
Joined: 08 Mar 2004 Posts: 14
|
Yes... there was some problem with the cluster, i couldn't see the clustered queue when i did
dis qcluster(*).
Now my mq support team corrected the problem, not sure what they did, might have refreshed the queuemanagers.
Now i am able to put a message into the clustered queue REQUEST_QUEUE thru the sample program binary "amqsput", which is part of MQ installation.
But thru java program, i am still getting 2085 error. At the point where i am trying to create MQQueue object for the Cluster queue REQUEST_QUEUE.
I tried qMgr1Object.accessQueue(REQUEST_QUEUE_NAME, options);
and qMgr1Object.accessQueue(REQUEST_QUEUE_NAME, options, QMGR1_NAME, null,null);
But still getting the 2085 error.
Do i need to do anything different.
Thanks,
Janaki. |
|
Back to top |
|
 |
pjramana |
Posted: Wed Mar 17, 2004 10:46 am Post subject: |
|
|
Novice
Joined: 08 Mar 2004 Posts: 14
|
Hi EddieA,
Thanks for the reply.
I am trying to use base Java MQ. I am not using MQJMS.
Thanks,
Janaki. |
|
Back to top |
|
 |
EddieA |
Posted: Wed Mar 17, 2004 11:12 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
I'm going to guess that it's the same issue:
Quote: |
qMgr1Object.accessQueue(REQUEST_QUEUE_NAME, options, QMGR1_NAME, null,null); |
Drop the QMGR1_NAME part.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
pjramana |
Posted: Wed Mar 17, 2004 11:50 am Post subject: |
|
|
Novice
Joined: 08 Mar 2004 Posts: 14
|
Atlast it seems to be working now, i specified MQC.MQOO_BIND_NOT_FIXED option on MQQueue open options. My program was able to connect to the cluster queue "REQUEST_QUEUE".
These are the open options i am using. MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING + MQC.MQOO_BIND_NOT_FIXED
And i am using the openOptions
MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING + MQC.MQOO_BIND_AS_Q_DEF
for the REPLY_QUEUE which is local to my QManager QMGR1.
At this point of time i am getting error 2033 for REPLY_QUEUE, which is "NO_MSG_AVAILABLE". So i need to test it with some messages.
EddieA and gunter. Thanks for your suggestions.
Thanks,
Janaki. |
|
Back to top |
|
 |
|