Author |
Message
|
vatz |
Posted: Fri Apr 16, 2004 6:52 am Post subject: Problem when connecting from a Java program - SOLVED! |
|
|
Newbie
Joined: 16 Jan 2004 Posts: 5
|
Hi all,
I have a Windows 2003 server running WMQ Server 5.3. I have written
a Java program (using a client connection) to connect to a queue manager. When I run this program from my machine I get the following error:
"MQJE001: Completion Code 2, Reason 2058".
When I run the same program from the WMQ Server machine I don't have this problem.
The following is the code snippet from my program:
-----------------------------------------------------------------------------------
String MyQueueMGR = "QM24by7";
MQQueueManager MQPutQMgr = new MQQueueManager(MyQueueMGR);
MQEnvironment.properties.put( MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT);
MQEnvironment.hostname = "10.1.254.38";
MQEnvironment.port = 1414;
MQEnvironment.channel = "SYSTEM.DEF.SVRCONN";
MQQueue MQPutQ = MQPutQMgr.accessQueue("my.message.queue", MQC.MQOO_OUTPUT, null, null, null);
MQMessage MQPutMsg = new MQMessage();
MQPutMsg.characterSet = 1208;
MQPutMsg.writeString("This_is_my_message");
MQPutMessageOptions pmo = new MQPutMessageOptions();
MQPutQ.put(MQPutMsg, pmo);
bRet = MQPutMsg.messageId;
MQPutQ.close();
MQPutQMgr.disconnect();
-----------------------------------------------------------------------------------
I'm sure that the queue manager is running (I've checked using dspmq) and the name of the queue manager (including cases) is correct.
Can someone help?
Thanks,
Vats
Last edited by vatz on Sat Apr 17, 2004 1:38 am; edited 1 time in total |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Apr 16, 2004 6:57 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Is the listener on your queue manager running? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
RogerLacroix |
Posted: Fri Apr 16, 2004 7:12 am Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Hi,
MQ Object names are case sensitive. i.e. QM24by7 is not the same as QM24BY7
Here is a quick list to debug this:- Is the IP correct or reachable?
- Do you have the correct port number?
- Is the queue manager running?
- Is the queue manager's listener program running? (on the port you think it is on??)
- Are you using the correct queue manager name in your program (check spelling / case upper/lower)?
One of these steps will fix the problem.
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
vatz |
Posted: Fri Apr 16, 2004 8:00 am Post subject: |
|
|
Newbie
Joined: 16 Jan 2004 Posts: 5
|
The listener on my queue manager is running.
The IP Address of the queue manager server is correct and reachable
The port number is 1414
The queue manager is running
The listener is also running on 1414.
The spelling (and case) of the queue manager is correct.
I tried a few things and these are my findings:
I have WMQ Server also on my laptop (Win XP). I'm able to access the remote queue manager from WMQ Explorer console on my laptop
When I run the program and access the local queue manager, I'm succesful, but when I access the remote queue manager (Queue manager of the other machine) I'm having problems
I also suspect that the program is trying to use bindings mode for connection, 'cos when I ran it on a machine in the network that has no WMQ Server installed it was giving the "java.lang.UnsatisfiedLinkError : mqjbnd05 ..." error
Thanks,
Srivats |
|
Back to top |
|
 |
mqonnet |
Posted: Fri Apr 16, 2004 8:36 am Post subject: |
|
|
 Grand Master
Joined: 18 Feb 2002 Posts: 1114 Location: Boston, Ma, Usa.
|
Make sure that the listener is attached to the queue manager you want to connect to. Or else you would get a 2058.
To test if its to do with your app or if your qm is incorrectly set up just define MQSERVER variable on your client system and run amqsputc to connect to this qm. If you are able to connect and put messages, then you have an issue with your app. If you still get a 2058, then there is some config issue on the Server side where your qm resides.
Cheers
Kumar |
|
Back to top |
|
 |
bower5932 |
Posted: Fri Apr 16, 2004 8:38 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
|
Back to top |
|
 |
RogerLacroix |
Posted: Fri Apr 16, 2004 1:06 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Duh!!
Good catch Jeff.
Vatz, the code should be:
Code: |
String MyQueueMGR = "QM24by7";
MQEnvironment.properties.put( MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT);
MQEnvironment.hostname = "10.1.254.38";
MQEnvironment.port = 1414;
MQEnvironment.channel = "SYSTEM.DEF.SVRCONN";
MQQueueManager MQPutQMgr = new MQQueueManager(MyQueueMGR);
MQQueue MQPutQ = MQPutQMgr.accessQueue("my.message.queue", MQC.MQOO_OUTPUT, null, null, null);
MQMessage MQPutMsg = new MQMessage();
MQPutMsg.characterSet = 1208; // THIS IS A BAD IDEA!!!!
MQPutMsg.writeString("This_is_my_message");
MQPutMessageOptions pmo = new MQPutMessageOptions();
MQPutQ.put(MQPutMsg, pmo);
bRet = MQPutMsg.messageId;
MQPutQ.close();
MQPutQMgr.disconnect(); |
Regards,
Roger Lacroix _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
vatz |
Posted: Sat Apr 17, 2004 1:34 am Post subject: |
|
|
Newbie
Joined: 16 Jan 2004 Posts: 5
|
Yeah finally managed to get rid of the problem. I tried setting my
MQEnvironment before creating a MQQueueManager object and it worked
Thanks for all the help!
Thanks Roger... yeah you are right with the code (instantiating the
MQQueueManager after setting the MQEnvironment)... this was in fact
what I did to get it working last evening.
BTW, I notice you have commented that "IT IS IS A BAD IDEA!!!!" to set
the charset. I did it to force UTF-8 'Cos my subscribing business
application understands only UTF-8. Appreciate any suggestions you may have on this.
Regards,
Vats |
|
Back to top |
|
 |
RogerLacroix |
Posted: Sat Apr 17, 2004 8:38 am Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Hi,
You should use the default character set and let the queue manager do the conversion for you.
Are you writing your message data in UTF-8 format?
Regards,
Roger Lacroix _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
vatz |
Posted: Tue Apr 20, 2004 11:26 pm Post subject: |
|
|
Newbie
Joined: 16 Jan 2004 Posts: 5
|
Hi,
When you say :
Quote: |
You should use the default character set and let the queue manager do the conversion for you. |
do you mean the system locale (charset) of the operating system or the CCSID default of 819?
I've changed my queue manager as UTF-8 and setting the message characterset in my java program to UTF-8.
Regards,
Vats |
|
Back to top |
|
 |
RogerLacroix |
Posted: Wed Apr 21, 2004 7:00 am Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
|
Back to top |
|
 |
|