Author |
Message
|
gr111 |
Posted: Mon Jul 28, 2003 12:08 am Post subject: Sending msg to Remote Q from Java Prog |
|
|
Newbie
Joined: 27 Jul 2003 Posts: 5
|
I want to send a msg to remote queue from java Prog. Sending to local queue is okay but while putting the msg to remote queue gives the error -
=========================================
MQJE001: Completion Code 2, Reason 2087
An MQ Error Occurred: Completion Code is : 2
The Reason Code is : 2087
com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2087
at com.ibm.mq.MQQueueManager.accessQueue(MQQueueManager.java:1391)
at QSender.main(QSender.java:41)
=========================================
Any code / help |
|
Back to top |
|
 |
pvivek |
Posted: Mon Jul 28, 2003 4:10 am Post subject: |
|
|
Newbie
Joined: 28 Jul 2003 Posts: 1
|
A few days back I was having the same problems. I suggest you first get a hold on the digest of reason codes from
http://www-3.ibm.com/software/integration/mqfamily/library/
manualsa/csqzak05/csqzak05tfrm.htm
Regarding remote queues, your set-up must be proper.
You should have a remote-queue on your machine, which has an Xmit queue attached to it and a channel that services that Xmit queue. Your problem might be that you have missed some steps in between. |
|
Back to top |
|
 |
gr111 |
Posted: Mon Jul 28, 2003 5:04 am Post subject: URGENT --- |
|
|
Newbie
Joined: 27 Jul 2003 Posts: 5
|
I did these steps -
DEFINE QREMOTE ('LOCAL.REMOTE.QUEUE') +
DESCR ('Queue ') +
RNAME ('REMOTE.QUEUE') +
RQMNAME ('remote.queue.manager') +
XMITQ ('INQUOTE.XMIT.QUEUE')
And on the other remote server I craeted a queue which is of local queue.
My main aim is - when I run the java prog. Prog will put he msg in the LOCAL.REMOTE.QUEUE but actually msg should be routed to REMOTE.QUEUE.
At the code level I am just doing this -
MQQueueManager qMgr = new MQQueueManager("local_q_manager") ;
int openOptions = MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING ;
MQQueue queue = qMgr.accessQueue(LOCAL.REMOTE.QUEUE, openOptions, null, null, null);
When it tries to access the queue it throws the error
MQJE001: Completion Code 2, Reason 2087
Any pointer / code for this will really be a grear help. |
|
Back to top |
|
 |
mqonnet |
Posted: Mon Jul 28, 2003 6:37 am Post subject: |
|
|
 Grand Master
Joined: 18 Feb 2002 Posts: 1114 Location: Boston, Ma, Usa.
|
By any chance do you have, RQMNAME ('remote.queue.manager') , where "remote.queue.manager" is the same for both the local and the remote qm. This isnt allowed.
Since you did not post the exact queue defs, only assumptions can be made.
Cheers
Kumar |
|
Back to top |
|
 |
harwinderr |
Posted: Mon Jul 28, 2003 8:17 pm Post subject: |
|
|
 Voyager
Joined: 29 Jan 2002 Posts: 90
|
Hi,
I tried with this setup. The local queue manager is QM1 and the remote queue manager is QM2.
QM1.mqsc
def chl(chan1) chltype(sdr) trptype(tcp) conname('remote_queue_manager(port)') xmitq(xq)
def ql(xq) usage(xmitq)
def qr('remoteQ') rqmname('QM2') rname('remote.local.queue') xmitq(xq)
QM2.mqsc
def chl(chan1) chltype(rcvr) trptype(tcp)
def ql('remote.local.queue')
On QM2, start the listener at port number specicfied on sdr channel definition and on QM1 start the channel using runmqchl.
Below is the code snippet :
Code: |
import com.ibm.mq.*;
class RemoteQ {
public static void main(String args[]) {
String QMgr = "QM1";
MQQueueManager qManager;
String msgText = new String("Basic Test");
System.out.println("Connecting to queue manager: " + QMgr );
try {
qManager = new MQQueueManager(QMgr);
System.out.println("Connected to queue manager");
System.out.println("Accessing queue for output");
int openOptions = MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING ;
MQQueue q = qManager.accessQueue("remoteQ", openOptions, null, null, null);
System.out.println("Queue accessed");
System.out.println("Creating message for send");
MQMessage hello_world = new MQMessage();
hello_world.format = MQC.MQFMT_STRING;
hello_world.writeString(msgText);
System.out.println("Sending message");
MQPutMessageOptions pmo = new MQPutMessageOptions();
q.put(hello_world,pmo);
System.out.println("Message sent");
System.out.println("Closing queue");
q.close();
System.out.println("Queue closed, closing queue manager");
qManager.disconnect();
System.out.println("Queue manager closed");
}
catch(MQException ex) {
System.out.println("A WebSphere MQ error occurred : Completion code " +
ex.completionCode + " Reason code " + ex.reasonCode);
}
catch (java.io.IOException ex) {
System.out.println("An error occurred whilst writing to the message buffer: " + ex);
}
}
}
|
Hope this works for you
Later,
HR |
|
Back to top |
|
 |
gr111 |
Posted: Mon Jul 28, 2003 9:34 pm Post subject: |
|
|
Newbie
Joined: 27 Jul 2003 Posts: 5
|
harwinderr,
Your steps was really helpful. But I am stuck with this error when I try to start the channel
C:\>runmqchl -m QM1 -c chan1
5724-B41 (C) Copyright IBM Corp. 1994, 2002. ALL RIGHTS RESERVED.
07/29/2003 10:58:31 Channel program started.
07/29/2003 10:58:33 AMQ9203: A configuration error for TCP/IP occurred.
07/29/2003 10:58:33 AMQ9999: Channel program ended abnormally.
Any Idea |
|
Back to top |
|
 |
harwinderr |
Posted: Mon Jul 28, 2003 10:39 pm Post subject: |
|
|
 Voyager
Joined: 29 Jan 2002 Posts: 90
|
There can be some configuration problem.
On QM1, you must have specified the sdr channel with a specific port, say 9999.
def chl(chan1) chltype(sdr) trptype(tcp) conname ('remote_queue_manager's_IP_address(9999)') xmitq(xq)
On QM2 you must start the listener with on the same port.
eg, $ runmqlsr -m QM2 -t TCP -p 9999
Then start the channel on QM1
$ runmqchl -m QM1 -c CHAN1
(or 'chan1' if you have given the channel name in single quotes while creating)
Try restarting your queue managers before the setup.
Hope this helps
Later,
HR |
|
Back to top |
|
 |
gr111 |
Posted: Mon Jul 28, 2003 11:07 pm Post subject: |
|
|
Newbie
Joined: 27 Jul 2003 Posts: 5
|
Thanks a ton !!!
Its running fine. The problem was with channel definition with the conname attribute, there I was making a minor mistake earlier I was using QMGR name instead of HOSTNAME.
Thanks to all of you for being a great group of people |
|
Back to top |
|
 |
|