Author |
Message
|
kingkb |
Posted: Tue Mar 16, 2010 6:05 pm Post subject: Error while putting msg in the range of 32227 - 32270 bytes |
|
|
Newbie
Joined: 28 Jan 2009 Posts: 5
|
Hi All,
We are getting an exception while putting a message in the range of 32227 – 32270 bytes (inclusive) using put() method of MQQueue Class in com.ibm.mq.jar. The connection handle becomes invalid immediately after MQQueue.put() call and any subsequent operation (commit or close) throws MQRC 2009.
Strangely the put() method of MQQueueManager class works fine for any message in this range.
Code snippet that throws exception:
MQQueueManager queueManager = new MQQueueManager(“QM1”, urlConfigFile);
int openOption = MQC.MQOO_OUTPUT | MQC.MQOO_SET_ALL_CONTEXT;
MQQueue myq = queueManager.accessQueue(“TestQueue”, openOption) ;
MQPutMessageOptions pmo = new MQPutMessageOptions() ;
pmo.options = MQC.MQPMO_SET_ALL_CONTEXT|MQC.MQPMO_SYNCPOINT;
MQMessage msg = new MQMessage();
msg.format = MQC.MQFMT_STRING;
msg.writeString(messageData);
msg.messageId = msgId.getBytes();
myq.put(msg, pmo);
Code snippet that works fine:
MQQueueManager queueManager = new MQQueueManager(“QM1”, urlConfigFile);
MQPutMessageOptions pmo = new MQPutMessageOptions() ;
pmo.options =
MQC.MQPMO_SET_ALL_CONTEXT|MQC.MQPMO_SYNCPOINT;
MQMessage msg = new MQMessage();
msg.format = MQC.MQFMT_STRING;
msg.writeString(messageData);
msg.messageId = msgId.getBytes();
queueManager.put(“TestQueue”, “QM1”, msg, pmo);
Exception Message:
Error occured during API call - reason code10
MQJE001: Completion Code 2, Reason 2009
MQJE001: An MQException occurred: Completion Code 2, Reason 2009
It was found that the difference in these two methods is that QueueManager uses MQPUT1 internally while MQQueue uses MQPUT.
It would be great if you can provide some pointers on this.
Please let me know if you need any additional information on the problem statement.
Note:
1. The version of MQ used is 6.0.2.5 and JDK version is jdk1.6.
2. We were able to successfully put the message in the same range using utilities like MQExplorer and RFHUtil.
3. Since the code is already in Production for more than 3 years, using an alternate method might not be a feasible option. |
|
Back to top |
|
 |
RogerLacroix |
Posted: Fri Mar 19, 2010 11:59 am Post subject: Re: Error while putting msg in the range of 32227 - 32270 by |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
kingkb wrote: |
We are getting an exception while putting a message in the range of 32227 – 32270 bytes (inclusive) using put() method of MQQueue Class in com.ibm.mq.jar. |
I test Java applications all the time and I have never had this problem. What platform is your MQ queue manager running on? I assume your Java is connecting to the queue manager in client mode.
Why don't you clean up the code and only set/use functions/features that you need to.
i.e.
kingkb wrote: |
Code: |
int openOption = MQC.MQOO_OUTPUT | MQC.MQOO_SET_ALL_CONTEXT;
MQQueue myq = queueManager.accessQueue("TestQueue", openOption) ;
MQPutMessageOptions pmo = new MQPutMessageOptions() ;
pmo.options = MQC.MQPMO_SET_ALL_CONTEXT|MQC.MQPMO_SYNCPOINT;
|
|
Bad programming practice to be requesting and doing "Set All Context". Secondly, you are NOT filling in all of the fields of the MQMD, even though you told MQ ("Set All Context") that your code would be setting context.
Third, you are specifying SyncPoint but I do see any commit call.
Fourth, you should NOT be setting the MsgID. You should let MQ do that for you. You can retrieve it after the call if you need to.
Code: |
MQQueueManager queueManager = new MQQueueManager("QM1", urlConfigFile);
int openOption = MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING;
MQQueue myq = queueManager.accessQueue("TestQueue", openOption);
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = MQC.MQPMO_FAIL_IF_QUIESCING;
MQMessage msg = new MQMessage();
msg.format = MQC.MQFMT_STRING;
msg.writeString(messageData);
myq.put(msg, pmo);
saveMsgId = msg.messageId; |
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Mar 19, 2010 6:00 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Roger, looks like the second part of his code was from the service doing the reply to the request. The only comment I would have to it, is to follow the flag settings on the request. I would also have expected msgId to correlId and not msgId to msgId...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kingkb |
Posted: Sun Mar 21, 2010 4:25 pm Post subject: |
|
|
Newbie
Joined: 28 Jan 2009 Posts: 5
|
Hi Roger,
Thanks for the reply.
Do you mean that you never faced this kind of a problem with your java application for putting a message in this range using MQQueue.put() method?
The reason for asking this is, we are also using our java application for more than 3 years now and never encountered such a problem until other day when we got a message in this range for the very first time.
Your assumptions are correct, our java application is connecting to queue manager in client mode.
We are on HP-UX (B.11.23) operating system.
Really appreciate your inputs on good practices and code cleanup activities. However, since our code is very stable in production for quite sometime, we will have to analyze a bigger impact of this before taking any further decision.
Thanks,
KB. |
|
Back to top |
|
 |
rekarm01 |
Posted: Sun Mar 21, 2010 5:01 pm Post subject: Re: Error while putting msg in the range of 32227-32270 byte |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
There's a similar post here.
The suggested fixes were to make sure that the client jars are up to date, check for FDCs on the server side, or open a PMR. |
|
Back to top |
|
 |
kingkb |
Posted: Sun Mar 21, 2010 9:58 pm Post subject: |
|
|
Newbie
Joined: 28 Jan 2009 Posts: 5
|
We did go through this post and were thinking that we might get some pointers in this forum as a similar problem was already identified way back in Sep'06 . |
|
Back to top |
|
 |
ramires |
Posted: Mon Mar 22, 2010 6:50 am Post subject: |
|
|
Knight
Joined: 24 Jun 2001 Posts: 523 Location: Portugal - Lisboa
|
check the com.ibm.mq.jar version you are using, I had something similar when using com.ibm.mq.jar version 6.0.0.0 with a MQ server v 6.0.2.5
Regards |
|
Back to top |
|
 |
umesh_mq |
Posted: Wed Mar 24, 2010 4:52 am Post subject: Error while putting msg in the range of 32227 - 32270 bytes |
|
|
Newbie
Joined: 15 Mar 2010 Posts: 1
|
Hi kingkb,
Please try out the following options:
1. Trying the APIs that come with MQ v7.0 should provide you with a solution. Use the put() method of MQQueue Class in com.ibm.mq.jar which comes along with MQ v7.0. If required, additional jars may have to be taken from the latest MQ version for proper compilation of the code. It is just that the APIs have to be taken from MQ v7.0. The installed MQ version can still be MQ v6.0
2. Another possible option is to just install and move to MQ v7.0 which doesn't require the addition of any new external jars into the existing application.[/b]. This means the put() method of MQQueue Class can still refer to com.ibm.mq.jar of MQ v6.0.
Good luck !! |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Mar 24, 2010 10:32 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
@umesh_mq This is a known issue and he needs to upgrade the MQ installation to the required level. (generally x.0.0.0) are not the best.
It is a bad idea to start and mix and match version on the same box....
It is even worse to try and mix and match jars from different versions.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|