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 while trying to put messages

Post new topic  Reply to topic
 Problem while trying to put messages « View previous topic :: View next topic » 
Author Message
Björn
PostPosted: Wed Sep 10, 2003 7:52 am    Post subject: Problem while trying to put messages Reply with quote

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
View user's profile Send private message
vennela
PostPosted: Wed Sep 10, 2003 7:56 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
mqonnet
PostPosted: Wed Sep 10, 2003 8:09 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
vennela
PostPosted: Wed Sep 10, 2003 8:14 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
bower5932
PostPosted: Wed Sep 10, 2003 9:39 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Björn
PostPosted: Thu Sep 11, 2003 3:49 am    Post subject: Reply with quote

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
View user's profile Send private message
bower5932
PostPosted: Thu Sep 11, 2003 4:07 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Björn
PostPosted: Thu Sep 11, 2003 4:31 am    Post subject: Reply with quote

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
View user's profile Send private message
Björn
PostPosted: Thu Sep 11, 2003 4:59 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Problem while trying to put messages
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.