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 » MQException always display to stderr

Post new topic  Reply to topic
 MQException always display to stderr « View previous topic :: View next topic » 
Author Message
tslh
PostPosted: Wed Nov 22, 2006 2:59 am    Post subject: MQException always display to stderr Reply with quote

Newbie

Joined: 22 Nov 2006
Posts: 3

Hello,

I have a little MQ Message browser written with Java Base API. When I use it, I always get the "MQJE001 : Code 2, reason 2033" displayed on my stderr when I reach the end of the messages list, even if I catch the MQException.

Here an excerpt from my code:

Code:

try {
         while (true) {
            //myMessage.clearMessage();
            MQMessage myMessage = new MQMessage();
            // Retrieving is totally independant: clear correlation and messageID indications.
            // The access is then sequential
            myMessage.correlationId = MQC.MQCI_NONE;
            myMessage.messageId     = MQC.MQMI_NONE;
            _queue.get(myMessage, gmo);
            // Cache it.
            _messages.add(myMessage);
         }
         
      } catch(MQException e) {
         if (e.reasonCode == MQException.MQRC_NO_MSG_AVAILABLE) {
            // No more message, normal end.
         } else e.printStackTrace();            
      } finally {
         closeQueue();
      }


Does it exist a manner to avoid this annoying message?

Thanks for your help!
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Nov 22, 2006 4:43 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Yes.

MQEnvironment. something (log, I think) = null.

Someone will be along in a bit to be more specific.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
tslh
PostPosted: Wed Nov 22, 2006 5:56 am    Post subject: Reply with quote

Newbie

Joined: 22 Nov 2006
Posts: 3

Hallelujah!

You were quite near the answer: it's a static field from MQException class:

Code:
MQException.log = null


This prevent really the Exception to be duplicated to the stderr.

A great "thank you" for leading me toward the answer.

NB: MQEnvironnement.disableTrace() concerns only the debug mode for IBM helpdesk.


Last edited by tslh on Wed Nov 22, 2006 6:06 am; edited 1 time in total
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Nov 22, 2006 5:59 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

It's this kind of detail that I would look up if I needed to use it.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
billybong
PostPosted: Wed Nov 22, 2006 7:01 am    Post subject: Reply with quote

Disciple

Joined: 22 Jul 2005
Posts: 150
Location: Stockholm, Sweden

If you just want to remove the 2033's and not all logs a cleaner way would be:

Code:
MQException.logExclude(new Integer(MQException.MQRC_NO_MSG_AVAILABLE))

_________________
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Integration Developer V6.0
IBM Certified System Administrator - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere DataPower
Back to top
View user's profile Send private message Visit poster's website
tslh
PostPosted: Thu Nov 23, 2006 7:12 am    Post subject: Reply with quote

Newbie

Joined: 22 Nov 2006
Posts: 3

Thank you for that precision. It's quite useful.
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 » MQException always display to stderr
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.