Author |
Message
|
notoneword |
Posted: Wed Jun 22, 2011 10:43 am Post subject: Java API: MQRC 2421 writing RFH2 on certain platforms |
|
|
 Apprentice
Joined: 17 May 2011 Posts: 37
|
I'm getting MQRC 2421 errors (MQRC_RFH_FORMAT_ERROR) when putting messages with RFH2 headers on certain platforms. It works fine on Windows MQ6 and z/OS MQ7. It's failing on MQ7 Windows & Linux. Here's the code:
Code: |
MQHeaderList list = new MQHeaderList();
MQRFH2 rfh = new MQRFH2();
...
while (nameValIter.hasNext()) {
rfh.setNameValueData(nameValIter.next());
}
rfh.setFormat(MQConstants.MQFMT_STRING);
..
list.add(rfh);
msg.format = MQConstants.MQFMT_RF_HEADER_2;
list.write(msg); |
Here's the MQRFH2 structures, identical whether failing or not.
Quote: |
MQ7 Linux (fails)
MQRFH2 (com.ibm.mq.headers.internal.store.ByteStore [encoding: 0x00000001, ccsid: 1208, size: 60] @9303440)
MQCHAR4 StrucId: "RFH "
MQLONG Version: 2 (0x00000002)
MQLONG StrucLength: 60 (0x0000003c)
MQLONG Encoding: 273 (0x00000111)
MQLONG CodedCharSetId: 437 (0x000001b5)
MQCHAR8 Format: "MQSTR "
MQLONG Flags: 0 (0x00000000)
MQLONG NameValueCCSID: 1208 (0x000004b8)
MQBYTE[] NameValueData: 0x00000014424d4d41444d494e3a524648322d4d5347202020
MQ6 windows (succeeds)
MQRFH2 (com.ibm.mq.headers.internal.store.ByteStore [encoding: 0x00000001, ccsid: 1208, size: 60] @30620998)
MQCHAR4 StrucId: "RFH "
MQLONG Version: 2 (0x00000002)
MQLONG StrucLength: 60 (0x0000003c)
MQLONG Encoding: 273 (0x00000111)
MQLONG CodedCharSetId: 437 (0x000001b5)
MQCHAR8 Format: "MQSTR "
MQLONG Flags: 0 (0x00000000)
MQLONG NameValueCCSID: 1208 (0x000004b8)
MQBYTE[] NameValueData: 0x00000014424d4d41444d494e3a524648322d4d5347202020 |
I'd appreciate any replies to speak to how to do this with the Java MQ API, I've been told to leave JMS out of it.
Seems to me like there's a difference between MQ6 and MQ7, and in MQ7 there's a difference in platforms, possibly a byte-order/encoding issue? I don't know, looking for any ideas, suggestions on things to try.
thanks,
Tom |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jun 22, 2011 10:52 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
I you want to use an RFH2 you should use JMS which will do it seemlessly for you. Non Java programs can use XMS for the same purpose.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mvic |
Posted: Wed Jun 22, 2011 10:54 am Post subject: Re: Java API: MQRC 2421 writing RFH2 on certain platforms |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
notoneword wrote: |
Seems to me like there's a difference between MQ6 and MQ7, and in MQ7 there's a difference in platforms, possibly a byte-order/encoding issue? I don't know, looking for any ideas, suggestions on things to try. |
Put on the very latest fix pack on client and server then re-test, to make sure it's not an already-fixed issue. After that, if you see an incompatibility between v6 and v7, open a PMR and get IBM to look at it for you. |
|
Back to top |
|
 |
notoneword |
Posted: Wed Jun 22, 2011 10:56 am Post subject: |
|
|
 Apprentice
Joined: 17 May 2011 Posts: 37
|
Thanks for the reply.
I"m trying to do this w/o the JMS classes. MQHeaderList allows you to add headers, it should work. It does work on many of the platforms. I'm currently being directed *not* to use the JMS classes for this so if anyone has any advice on using MQHeaderList, and what may account for the different results I'm seeing, I'd appreciate it. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jun 22, 2011 10:57 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I would use MQ v7 Message Properties instead of an RFH header.
These should get mapped to RFH headers when moving to a v6 qmgr or when connecting to a v6 qmgr (to the best of my knowledge). |
|
Back to top |
|
 |
notoneword |
Posted: Wed Jun 22, 2011 10:58 am Post subject: |
|
|
 Apprentice
Joined: 17 May 2011 Posts: 37
|
Thanks mvic, yeh, it's starting to look like PMR time.... |
|
Back to top |
|
 |
mvic |
Posted: Wed Jun 22, 2011 11:00 am Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
|
Back to top |
|
 |
notoneword |
Posted: Wed Jun 22, 2011 11:24 am Post subject: |
|
|
 Apprentice
Joined: 17 May 2011 Posts: 37
|
Thanks everyone for the replies and ideas! |
|
Back to top |
|
 |
notoneword |
Posted: Fri Jun 24, 2011 11:02 am Post subject: |
|
|
 Apprentice
Joined: 17 May 2011 Posts: 37
|
Opened PMR, and it turns out that MQ7 is much stricter about name-value properties than MQ6.
My problem in testing was that I was passing in just plain strings, no folder names defined. Once I added <mcd>... </mcd> around the string, the 2421 error was gone.
... so hopefully my stupidity will serve as an example/warning for others!  |
|
Back to top |
|
 |
mvic |
Posted: Fri Jun 24, 2011 3:09 pm Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
notoneword wrote: |
Once I added <mcd>... </mcd> around the string, the 2421 error was gone. |
If you are able to alter your code to "make it work" then maybe that's fine.
But I couldn't see what you had done wrong in your application source code. It also doesn't sound right that the same program would work on one version or server, yet not on another.
What did you change in your source (can you give us another snippet?) to make it work? |
|
Back to top |
|
 |
mvic |
Posted: Fri Jun 24, 2011 3:13 pm Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
notoneword wrote: |
Opened PMR, and it turns out that MQ7 is much stricter about name-value properties than MQ6. |
What fix pack of MQ V7 was it?
BTW I didn't understand "much stricter". What is the difference - does MQ v7 handle the MQRFH2 object in your Java program differently? |
|
Back to top |
|
 |
notoneword |
Posted: Fri Jun 24, 2011 3:31 pm Post subject: |
|
|
 Apprentice
Joined: 17 May 2011 Posts: 37
|
I had applied fixpack 7.0.1.5 as IBM suggested.
Here's a quote from the email that may give some more context about the 'strictness' of RFH handling in MQ7:
Quote: |
"MQ V7 supports message properties and in order to implementthis
support some parsing of the MQRFH2 header is performed.This requires
MQ V7 to be more aware of the MQRFH2 content, andmore stringent
validation of the MQRFH2 is performed." |
.. and nothing in my code really had to change, it was my test data I had to change. I had been - rather cluelessly I admit - just passing in a string like 'RFH:DATA' w/o any folders specified. The error went away when I passed in '<mcd>RFH:DATA</mcd>' instead.
Hope this helps answer your questions... |
|
Back to top |
|
 |
notoneword |
Posted: Fri Jun 24, 2011 3:42 pm Post subject: |
|
|
 Apprentice
Joined: 17 May 2011 Posts: 37
|
... also, I've noticed issues, even with my changes that work, if I set the Encoding of the message to 546, I'll get 2421 errors again. I *think* that it's related to this issue - http://www-01.ibm.com/support/docview.wss?uid=swg1IZ86625 (scheduled to be fixed in 7.0.1.6) - though that is purely speculation on my part. |
|
Back to top |
|
 |
mvic |
Posted: Fri Jun 24, 2011 4:24 pm Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
I don't know why you would want to change the Encoding, in a Java program. The Encoding declares how fields holding numbers are byte-ordered, etc. Do you actually need to alter the value to 546 ? Interested to know why, if so. |
|
Back to top |
|
 |
notoneword |
Posted: Sat Jun 25, 2011 9:44 am Post subject: |
|
|
 Apprentice
Joined: 17 May 2011 Posts: 37
|
Well, it's a general purpose message editor, in which the user can edit MQMD fields, Encoding being one of them. Are you saying that the byte-order of java would affect whether MQ could write the fields in different encoding values? I'm curious now whether I should even be trying that... |
|
Back to top |
|
 |
|