Author |
Message
|
tslh |
Posted: Wed Nov 22, 2006 2:59 am Post subject: MQException always display to stderr |
|
|
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 |
|
 |
jefflowrey |
Posted: Wed Nov 22, 2006 4:43 am Post subject: |
|
|
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 |
|
 |
tslh |
Posted: Wed Nov 22, 2006 5:56 am Post subject: |
|
|
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 |
|
 |
jefflowrey |
Posted: Wed Nov 22, 2006 5:59 am Post subject: |
|
|
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 |
|
 |
billybong |
Posted: Wed Nov 22, 2006 7:01 am Post subject: |
|
|
 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 |
|
 |
tslh |
Posted: Thu Nov 23, 2006 7:12 am Post subject: |
|
|
Newbie
Joined: 22 Nov 2006 Posts: 3
|
Thank you for that precision. It's quite useful. |
|
Back to top |
|
 |
|