ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Problem when connecting from a Java program - SOLVED!

Post new topic  Reply to topic
 Problem when connecting from a Java program - SOLVED! « View previous topic :: View next topic » 
Author Message
vatz
PostPosted: Fri Apr 16, 2004 6:52 am    Post subject: Problem when connecting from a Java program - SOLVED! Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Fri Apr 16, 2004 6:57 am    Post subject: Reply with quote

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
View user's profile Send private message
RogerLacroix
PostPosted: Fri Apr 16, 2004 7:12 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
vatz
PostPosted: Fri Apr 16, 2004 8:00 am    Post subject: Reply with quote

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
View user's profile Send private message
mqonnet
PostPosted: Fri Apr 16, 2004 8:36 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
bower5932
PostPosted: Fri Apr 16, 2004 8:38 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

If you are getting an error about mqjbnd05, you are connecting in bindings mode and not client mode. If the fragment above is what you have coded, you need to set your MQEnvironment before connecting to the qmgr not after. Try looking here:

http://www.mqseries.net/phpBB/viewtopic.php?t=14645&highlight=mqenvironment
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
RogerLacroix
PostPosted: Fri Apr 16, 2004 1:06 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
vatz
PostPosted: Sat Apr 17, 2004 1:34 am    Post subject: Reply with quote

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
View user's profile Send private message
RogerLacroix
PostPosted: Sat Apr 17, 2004 8:38 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
vatz
PostPosted: Tue Apr 20, 2004 11:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
RogerLacroix
PostPosted: Wed Apr 21, 2004 7:00 am    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

Code:
MQPutMsg.characterSet = MQC.MQCCSI_DEFAULT;


Regards,
Roger
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Problem when connecting from a Java program - SOLVED!
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.