Author |
Message
|
Björn |
Posted: Wed Sep 10, 2003 7:52 am Post subject: Problem while trying to put messages |
|
|
Newbie
Joined: 10 Sep 2003 Posts: 7
|
Hello again...
This one is driving me crazy. I want to write a program that will send messages to an MQSeries queue. However, it doesn't even connect to the MQSeries Server and gives me a 2059 as Returncode (No Queuemanager available). The connection itself should work though, as I've tested it with the amqsputc.exe tool that comes with the MQSeries Client for Windows 2000.
Here is the code I'm using:
Code: |
public void put(String putMsg) {
try {
/***********************************************/
/** Initialisierung und Aufbau der Verbindung **/
/***********************************************/
MQEnvironment.hostname = mImportHostA;
MQEnvironment.port = mImportPort;
MQEnvironment.channel = mServerConnectionChannel;
MQEnvironment.CCSID = 819;
MQQueueManager qMgr = new MQQueueManager(mImportQueuemanager1);
int openOptions = MQC.MQOO_OUTPUT | MQC.MQOO_SET_IDENTITY_CONTEXT;
MQQueue myQueue =
qMgr.accessQueue(mImportQueue, openOptions, null, null, null);
MQMessage myMessage = new MQMessage();
myMessage.userId = mMQPasswort;
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = MQC.MQPMO_NEW_MSG_ID | MQC.MQPMO_SET_IDENTITY_CONTEXT;
myMessage.writeString(putMsg);
myQueue.put(myMessage, pmo);
myQueue.close();
qMgr.close();
} catch (MQException ex) {
// MQException ausgeben
System.out.println(
"MQ exception: CC = " + ex.completionCode
+ " RC = " + ex.reasonCode);
} catch (IOException e) {
e.printStackTrace();
}
} |
the program does not get over the first few lines. It gives me the RC 2059 at the line where I'm creating the Queuemanager-object.
Any clue anyone?
Thx in advance
Björn |
|
Back to top |
|
 |
vennela |
Posted: Wed Sep 10, 2003 7:56 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
The listener on that port for that QueueManager should be running if your program has to work.
-------
Venny |
|
Back to top |
|
 |
mqonnet |
Posted: Wed Sep 10, 2003 8:09 am Post subject: |
|
|
 Grand Master
Joined: 18 Feb 2002 Posts: 1114 Location: Boston, Ma, Usa.
|
Believe you gotta add this.
MQEnvironment.MQC.TRANSPORT_PROPERTY = MQC.TRANSPORT_MQSERIES_CLIENT
This way you tell the MQ Client to use Client Java bindings.
Cheers
Kumar |
|
Back to top |
|
 |
vennela |
Posted: Wed Sep 10, 2003 8:14 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Kumar:
Quote: |
MQEnvironment.MQC.TRANSPORT_PROPERTY = MQC.TRANSPORT_MQSERIES_CLIENT |
I don't think this is necessary. It may not hurt to add this but it is not necessary.
-------
Venny |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Sep 10, 2003 9:39 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I can't tell what your types are, but I thought the port was an int. |
|
Back to top |
|
 |
Björn |
Posted: Thu Sep 11, 2003 3:49 am Post subject: |
|
|
Newbie
Joined: 10 Sep 2003 Posts: 7
|
Hello everyone,
thx for the tips, unfortunately, they don't help me
The port is of the type int, of course.
I cannot set the field MQEnvironment.MQC.TRANSPORT_PROPERTY as there is no such field in MQEnvironment! Don't know where to set that so...
Vennela: I believe you're talking about the listener of that QueueManager on the MQSeries server. It IS listening on the port, as I tested it successfully with the amqsputc.exe tool that came with the MQSeries Client.
I absolutely don't know what's wrong with my code. Maybe one of you has a little code-bit that works and put's a message into a queue?
Thx in advance
Björn |
|
Back to top |
|
 |
bower5932 |
Posted: Thu Sep 11, 2003 4:07 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I haven't looked at your code, but you could always take the hashtable approach to life:
http://www.developer.ibm.com/tech/sampmq.html
and look for mqhash.java. It puts the environment into a hashtable that it then passes in at queue manager creation. |
|
Back to top |
|
 |
Björn |
Posted: Thu Sep 11, 2003 4:31 am Post subject: |
|
|
Newbie
Joined: 10 Sep 2003 Posts: 7
|
Thx for the tip, I tried it, but still no luck. It's confusing me so much that this amqsputc.exe is working perfectly, and so is the part of my program that browses the queue. just the message-put won't work.
 |
|
Back to top |
|
 |
Björn |
Posted: Thu Sep 11, 2003 4:59 am Post subject: |
|
|
Newbie
Joined: 10 Sep 2003 Posts: 7
|
Hey everyone, I found the problem. It turned out to be a wrong IP address I had. Thanks A LOT for all your help and thoughts!
Cheers!
Björn |
|
Back to top |
|
 |
|