XMS.NET fails when receiving JMS message with RFH2 header at ParseJmsFolder

0

Our partner started using custom properties for messages being sent over IBM WebSphere MQ and our application developed using XMS.NET started to fail because of that.

It turned out that the error is being thrown inside parsing the JMS envelope and inside the ParseJmsFolder method.

This is the exception we get:

IBM.XMS.XMSException: Failed to create XMS message.
The wrong message type or properties were specified when creating a base message.
Check the linked WebSphere MQ exception reason and completion code for more information.
   at IBM.XMS.Client.WMQ.WmqReceiveMarshal.ConstructProviderMessageFromRFH2(Int32 messageBodyStyle)
   at IBM.XMS.Client.WMQ.WmqReceiveMarshal.CreateProviderMessage()
   at IBM.XMS.Client.WMQ.WmqReceiveMarshal.ExportProviderMessage()
   at IBM.XMS.Client.WMQ.WmqAsyncConsumerShadow.Consumer(Phconn hconn, MQMessageDescriptor mqmd, MQGetMessageOptions mqgmo, Byte[] pBuffer, MQCBC mqcbc)

Linked Exception : System.NullReferenceException: Object reference not set to an instance of an object.
   at IBM.XMS.Client.WMQ.Messages.WmqMessageBase.ParseJmsFolder(String input, Boolean persistenceFromMD)
   at IBM.XMS.Client.WMQ.WmqReceiveMarshal.ConstructProviderMessageFromRFH2(Int32 messageBodyStyle)

And these are the details from tracing the issue down:

[29.10.2015 11:24:32:893922 W. Europe Standard Time] 00000027 > UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase method=ParseJmsFolder(String,bool) [:] org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
entry [<jms><Dst>queue://SV2098743/LQ.CORE.EVENTS</Dst><Exp></Exp><Pri></Pri><Dlv>2</Dlv><Cid>1ade73268824414b8473c95ae93f7a57</Cid><Rto></Rto><Gid></Gid><Seq></Seq><Tms>1445934282747</Tms></jms>] [False]
[29.10.2015 11:24:32:895922 W. Europe Standard Time] 00000027 d UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
ParseFolderJms() : folder as string = <jms><Dst>queue://SV2098743/LQ.CORE.EVENTS</Dst><Exp></Exp><Pri></Pri><Dlv>2</Dlv><Cid>1ade73268824414b8473c95ae93f7a57</Cid><Rto></Rto><Gid></Gid><Seq></Seq><Tms>1445934282747</Tms></jms>
[29.10.2015 11:24:32:901923 W. Europe Standard Time] 00000027 > UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase method=ParseFolderToPropertyNodes(StringBuilder) [:] org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
entry [<Dst>queue://SV2098743/LQ.CORE.EVENTS</Dst><Exp></Exp><Pri></Pri><Dlv>2</Dlv><Cid>1ade73268824414b8473c95ae93f7a57</Cid><Rto></Rto><Gid></Gid><Seq></Seq><Tms>1445934282747</Tms>]
[29.10.2015 11:24:32:903923 W. Europe Standard Time] 00000027 d UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
ParseFolderToPropertyNodes(), Adding node values [Dst] [queue://SV2098743/LQ.CORE.EVENTS] []
[29.10.2015 11:24:32:905923 W. Europe Standard Time] 00000027 d UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
ParseFolderToPropertyNodes(), Adding node values [Exp] [] []
[29.10.2015 11:24:32:906923 W. Europe Standard Time] 00000027 d UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
ParseFolderToPropertyNodes(), Adding node values [Pri] [] []
[29.10.2015 11:24:32:908924 W. Europe Standard Time] 00000027 d UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
ParseFolderToPropertyNodes(), Adding node values [Dlv] [2] []
[29.10.2015 11:24:32:910924 W. Europe Standard Time] 00000027 d UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
ParseFolderToPropertyNodes(), Adding node values [Cid] [1ade73268824414b8473c95ae93f7a57] []
[29.10.2015 11:24:32:911924 W. Europe Standard Time] 00000027 d UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
ParseFolderToPropertyNodes(), Adding node values [Rto] [] []
[29.10.2015 11:24:32:913924 W. Europe Standard Time] 00000027 d UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
ParseFolderToPropertyNodes(), Adding node values [Gid] [] []
[29.10.2015 11:24:32:915924 W. Europe Standard Time] 00000027 d UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
ParseFolderToPropertyNodes(), Adding node values [Seq] [] []
[29.10.2015 11:24:32:916924 W. Europe Standard Time] 00000027 d UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
ParseFolderToPropertyNodes(), Adding node values [Tms] [1445934282747] []
[29.10.2015 11:24:32:918925 W. Europe Standard Time] 00000027 < UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase method=ParseFolderToPropertyNodes(StringBuilder) [:] org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
exit
[29.10.2015 11:24:32:920925 W. Europe Standard Time] 00000027 > UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase method=ExpandRefs(String) [:] org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
entry [queue://SV2098743/LQ.CORE.EVENTS]
[29.10.2015 11:24:32:922925 W. Europe Standard Time] 00000027 < UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase method=ExpandRefs(String) [:] org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
exit [queue://SV2098743/LQ.CORE.EVENTS]
[29.10.2015 11:24:32:923925 W. Europe Standard Time] 00000027 d UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
ParseJmsFolder(), PROP_DESTINATION_NAME  [queue://SV2098743/LQ.CORE.EVENTS]
[29.10.2015 11:24:32:925925 W. Europe Standard Time] 00000027 d UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
ParseJmsFolder(), PROP_EXPIRATION_NAME  [0]
[29.10.2015 11:24:32:926925 W. Europe Standard Time] 00000027 d UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
ParseJmsFolder(), PROP_PRIORITY_NAME  [0]
[29.10.2015 11:24:32:928926 W. Europe Standard Time] 00000027 d UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
ParseJmsFolder(), PROP_DELIVERYMODE_NAME  [1]
[29.10.2015 11:24:32:929926 W. Europe Standard Time] 00000027 > UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase method=ExpandRefs(String) [:] org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
entry [1ade73268824414b8473c95ae93f7a57]
[29.10.2015 11:24:32:930926 W. Europe Standard Time] 00000027 < UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase method=ExpandRefs(String) [:] org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
exit [1ade73268824414b8473c95ae93f7a57]
[29.10.2015 11:24:32:933926 W. Europe Standard Time] 00000027 d UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
ParseJmsFolder(), PROP_CORRELATIONID_NAME  [1ade73268824414b8473c95ae93f7a57]
[29.10.2015 11:24:32:934926 W. Europe Standard Time] 00000027 d UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
ParseJmsFolder(), PROP_REPLYTO_NAME  []
[29.10.2015 11:24:32:935926 W. Europe Standard Time] 00000027 > UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase method=ExpandRefs(String) [:] org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
entry []
[29.10.2015 11:24:32:979931 W. Europe Standard Time] 00000027 < UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase method=ExpandRefs(String) [:] org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
exit []
[29.10.2015 11:24:32:981931 W. Europe Standard Time] 00000027 X UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
System.NullReferenceException: Object reference not set to an instance of an object.
   at IBM.XMS.Client.WMQ.Messages.WmqMessageBase.ExpandRefs(String input)
   at IBM.XMS.Client.WMQ.Messages.WmqMessageBase.ParseJmsFolder(String input, Boolean persistenceFromMD)
[29.10.2015 11:24:32:993932 W. Europe Standard Time] 00000027 < UOW= source=IBM.XMS.Client.WMQ.Messages.WmqMessageBase method=ParseJmsFolder() [:] org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
exit
[29.10.2015 11:24:32:995932 W. Europe Standard Time] 00000027 X UOW= source=IBM.XMS.Client.WMQ.WmqReceiveMarshal org=IBM prod=WebSphere component=Message Service Client for .NET thread=[1 : 0]
System.NullReferenceException: Object reference not set to an instance of an object.
   at IBM.XMS.Client.WMQ.Messages.WmqMessageBase.ParseJmsFolder(String input, Boolean persistenceFromMD)
   at IBM.XMS.Client.WMQ.WmqReceiveMarshal.ConstructProviderMessageFromRFH2(Int32 messageBodyStyle)

Our partner suggests to try some settings in XMS.NET regarding the JMS behaviour, but all the options we have tried end up with the same error.

This is our configuration code:

factory.SetStringProperty(XMSC.WMQ_HOST_NAME, ".....com");
            factory.SetIntProperty(XMSC.WMQ_PORT, 1417);
            factory.SetStringProperty(XMSC.WMQ_CHANNEL, "....");
            factory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);
            factory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, "....");
            factory.SetIntProperty(XMSC.WMQ_BROKER_VERSION, XMSC.WMQ_BROKER_UNSPECIFIED); 

...

var session = queueConnection.CreateSession(false, AcknowledgeMode.ClientAcknowledge);
            var queue = session.CreateQueue("....");
            queue.SetIntProperty(XMSC.WMQ_MESSAGE_BODY, XMSC.WMQ_MESSAGE_BODY_JMS);
            var subscriber = session.CreateConsumer(queue);

EDIT:

This is an example message causing the issue

count=1412

        offset        : 0 1 2 3  4 5 6 7  8 9 A B  C D E F
0x00000000 (       0) : 52464820 00000002 00000108 00000111 : RFH........
0x00000010 (      16) : 000004b8 4d515354 52202020 00000000 : ..?MQSTR.......
0x00000020 (      32) : 000004b8 00000020 3c6d6364 3e3c4d73 : ..?....<mcd><Ms
0x00000030 (      48) : 643e6a6d 735f7465 78743c2f 4d73643e : d>jms_text</Msd>
0x00000040 (      64) : 3c2f6d63 643e2020 000000bc 3c6a6d73 : </mcd>.....?<jms
0x00000050 (      80) : 3e3c4473 743e7175 6575653a 2f2f5356 : ><Dst>queue://SV
0x00000060 (      96) : 32303938 3734332f 4c512e43 4f52452e : 2098743/LQ.CORE.
0x00000070 (     112) : 4556454e 54533c2f 4473743e 3c457870 : EVENTS</Dst><Exp
0x00000080 (     128) : 3e3c2f45 78703e3c 5072693e 3c2f5072 : ></Exp><Pri></Pr
0x00000090 (     144) : 693e3c44 6c763e32 3c2f446c 763e3c43 : i><Dlv>2</Dlv><C
0x000000a0 (     160) : 69643e31 61646537 33323638 38323434 : id>1ade732688244
0x000000b0 (     176) : 31346238 34373363 39356165 39336637 : 14b8473c95ae93f7
0x000000c0 (     192) : 6135373c 2f436964 3e3c5274 6f3e3c2f : a57</Cid><Rto></
0x000000d0 (     208) : 52746f3e 3c476964 3e3c2f47 69643e3c : Rto><Gid></Gid><
0x000000e0 (     224) : 5365713e 3c2f5365 713e3c54 6d733e31 : Seq></Seq><Tms>1
0x000000f0 (     240) : 34343539 33343238 32373437 3c2f546d : 445934282747</Tm
0x00000100 (     256) : 733e3c2f 6a6d733e 48347349 41414141 : s></jms>H4sIAAAA
0x00000110 (     272) : 41414141 414a5656 57335061 4f68442b : AAAAAJVVW3PaOhD+
0x00000120 (     288) : 4b347a37 31706e45 4e787744 4939524a : K4z71pnENxwDI9RJ
0x00000130 (     304) : 4b47307a 49595135 70706670 53306659 : KG0zIYQ5ppfpS0fY
0x00000140 (     320) : 69394667 79315353 51386d76 50797362 : i9Fgy1SSQ8mvPysb
0x00000150 (     336) : 4579416b 74432b4a 64766662 5a532f66 : EyAktC+JdvfbZS/f
0x00000160 (     352) : 72736d48 50336e57 65675370 65434836 : rsmHP3nWegSpeCH6
0x00000170 (     368) : 6c6e7670 57433051 635a4677 6b666174 : lnvpWC0QcZFwkfat
0x00000180 (     384) : 72394e50 46783272 70545154 4363734b : r9NPFx2rpTQTCcsK
0x00000190 (     400) : 41583172 41387236 51496c51 586d2f34 : AX1rA8r6QIlQXm/4
0x000001a0 (     416) : 43454c66 67314973 68526147 45617148 : CELfg1IshRaGEaqH
0x000001b0 (     432) : 36723631 30487256 732b3331 656e305a : 6r610HrVs+31en0Z
0x000001c0 (     448) : 46336b4f 386d6e47 784e4b38 37626951 : F3kO8mnGxNK87biQ
0x000001d0 (     464) : 59412f77 5436526c 47657453 77746266 : YA/wT6RlGetSwtbf
0x000001e0 (     480) : 6f6d5437 2b674973 41556e4a 644c4d43 : omT7+gIsAUnJdLMC
0x000001f0 (     496) : 36684337 2b6b386d 6b75644d 62753567 : 6hC7+k8mkudMbu5g
0x00000200 (     512) : 59335237 55754e32 2b394559 6e675679 : Y3R7UuN2+9EYngVy
0x00000210 (     528) : 62334957 4f687052 78334852 73685052 : b3IWOhpRx3HRshPR
0x00000220 (     544) : 7773564e 71626841 384d4d4b 4a4e4e59 : wsVNqbhA8MMKJNNY
0x00000230 (     560) : 4f35304d 2f347365 78722b75 78365068 : O50M/4sexr+ux6Ph
0x00000240 (     576) : 352b4859 4f4a7843 56633452 2f433678 : 5+HYOJxCVc4R/C6x
0x00000250 (     592) : 53544175 71467344 397a5145 79354f51 : STAuqFsD9zQEy5OQ
0x00000260 (     608) : 56664462 684c7059 54656837 5635324f : VfDbhLpYTeh7V52O
0x00000270 (     624) : 31323637 37566d6e 48667078 4e324451 : 12677VmnHfpxN2DQ
0x00000280 (     640) : 39656368 43304a69 482b4c4a 7a576f4a : 9echC0JiH+LJzWoJ
0x00000290 (     656) : 51744451 63377975 467a6a64 304f6d36 : QtDQc7yuFzjd0Om6
0x000002a0 (     672) : 5164736e 39745a41 76745844 4d755532 : Qdsn9tZAvtXDMuU2
0x000002b0 (     688) : 547a4a59 4d434567 6f772f6a 30653134 : TzJYMCEgow/j0e14
0x000002c0 (     704) : 69444733 3871346a 54566533 346b3252 : iDG38q4jTVe34k2R
0x000002d0 (     720) : 594f7455 4d775144 54364761 70327239 : YOtUMwQDT6Gap2r9
0x000002e0 (     736) : 5562796e 73656c39 53366832 6231776b : Ubynsel9S6h2b1wk
0x000002f0 (     752) : 4d4a4441 4e435257 79347876 57706e71 : MJDANCRWy4xvWpnq
0x00000300 (     768) : 62694531 646f556a 655a4136 4a6b534e : biE1doUjeZA6JkSN
0x00000310 (     784) : 4f484263 41303858 756d3935 316f346f : OHBcA08Xum951o4o
0x00000320 (     800) : 37664e45 6955376b 31775441 4c413843 : 7fNEiU7k1wTALA8C
0x00000330 (     816) : 7250334c 51716132 68384f32 66397950 : rP3LQqa2h8O2f9yP
0x00000340 (     832) : 6f6e6742 4f627667 776e4133 4e765153 : ongBObvgwnA3NvQS
0x00000350 (     848) : 6d4d3942 62554676 67753072 78484e4b : mM9BbUFvgu0rxHNK
0x00000360 (     864) : 77666d55 4a6b7a71 44556162 7654616c : wfmUJkzqDUabvTal
0x00000370 (     880) : 72594777 70516178 4c455843 30776934 : rYGwpQaxLEXC0wi4
0x00000380 (     896) : 7070376a 42686575 632b4746 4c616662 : pp7jBheuc+GFLafb
0x00000390 (     912) : 63344e65 32373930 6e614472 58335775 : c4Ne2790naDrX3Wu
0x000003a0 (     928) : 726f6839 4443644d 53456741 36596f4d : roh9DCdMSEgA6YoM
0x000003b0 (     944) : 3237304a 4b785743 3568716b 42703656 : 270JKxWC5hqkBp6V
0x000003c0 (     960) : 49715866 30667843 53576177 52736b38 : IqXf0fxCSWawRsk8
0x000003d0 (     976) : 63614d78 715a3149 73424c46 6b576544 : caMxqZ1IsBLFkWeD
0x000003e0 (     992) : 477a2b61 44712b4a 33536a51 386d2b38 : Gz+aDq+J3SjQ8m+8
0x000003f0 (    1008) : 50635154 344d4b63 45633141 4a494b72 : PcQT4MKcEc1AJIKr
0x00000400 (    1024) : 6a7a6834 6f566241 63524453 2f4c4a48 : jzh4oVbAcRDS/LJH
0x00000410 (    1040) : 37484f51 6b7a464b 6d49484d 7564625a : 7HOQkzFKmIHMudbZ
0x00000420 (    1056) : 4731454f 5165666a 44496f5a 4d777630 : G1EOQefjDIoZMwv0
0x00000430 (    1072) : 6438446a 6550644d 4c6b486a 68527a6d : d8DjePdMLkHjhRzm
0x00000440 (    1088) : 6a47636e 34687742 58765766 4645712f : jGcn4hwBXvWfFEq/
0x00000450 (    1104) : 3556375a 582f5765 5167627a 2b684363 : 5V7ZX/WeQgbz+hCc
0x00000460 (    1120) : 6735414d 55713778 614a7070 525a7270 : g5AMUq7xaJppRZrp
0x00000470 (    1136) : 556c456b 36776b74 79657444 57562f4e : UlEk6wktyetDWV/N
0x00000480 (    1152) : 526d6930 64386962 6e66594f 3156777a : Rmi0d8ibnfYO1Vwz
0x00000490 (    1168) : 4f555043 6773534e 4b2f5554 78637635 : OUPCgsSNK/UTxcv5
0x000004a0 (    1184) : 556b6b45 79334855 54306850 634f6d31 : UkkEy3HUT0hPcOm1
0x000004b0 (    1200) : 30495634 5034326d 37794b45 7a434442 : 0IV4P42m7yKEzCDB
0x000004c0 (    1216) : 4838364a 6659445a 392f446f 6764457a : H86JfYDZ9/DogdEz
0x000004d0 (    1232) : 75787776 6670616a 4f6e734f 45675364 : uxwvfpajOnsOEgSd
0x000004e0 (    1248) : 73307742 346c3561 794d7273 374c5938 : s0wB4l5ayMrs7LY8
0x000004f0 (    1264) : 374e572b 53466256 4357435a 4b4d3279 : 7NW+SFbVCWCZKM2y
0x00000500 (    1280) : 5539384a 77363644 2b33696b 4a327554 : U98Jw66D+3ikJ2uT
0x00000510 (    1296) : 4b484956 4b573969 37497559 61727777 : KHIVKW9i7IuYarww
0x00000520 (    1312) : 2b564573 71585655 30745a43 4867745a : +VEsqXVU0tZCHgtZ
0x00000530 (    1328) : 50617261 69643249 524b306b 596a436d : Paraid2IRK0kYjCm
0x00000540 (    1344) : 67314562 67656836 62436b59 4463534c : g1Ebgeh6bCkYDcSL
0x00000550 (    1360) : 36334c2b 5a4e5a45 4748596a 38453237 : 63L+ZNZEGHYj8E27
0x00000560 (    1376) : 61554b43 51657954 352f3335 6b31422f : aUKCQeyT5/35k1B/
0x00000570 (    1392) : 412b7a6a 4c7a6e39 48393774 66794954 : A+zjLzn9H97tfyIT
0x00000580 (    1408) : 43414141                            : CAAA
c#
.net
jms
xms
rfh2
asked on Stack Overflow Oct 29, 2015 by Tomas Grosup • edited Oct 30, 2015 by Tomas Grosup

1 Answer

1

Is the sender application a JMS (or XMS) application or they hand crafting JMS headers? What version of XMS .NET are you using? Using RFHUtil,

I sent a message containing the JMS folder data your provided above and I see that XMS .NET V8.0 works fine. I also had to set the message type as jms_bytes. So I am wondering if the sender application is setting the message type correctly. Without the message type, application will get type casting error while receiving message.

answered on Stack Overflow Oct 30, 2015 by Shashi

User contributions licensed under CC BY-SA 3.0