Service Virtualization

Expand all | Collapse all

Getting (MQRC_HEADER_ERROR) when placing message into the queue

  • 1.  Getting (MQRC_HEADER_ERROR) when placing message into the queue

    Posted Sep 27, 2017 10:18 PM

    Hi 23@kevin.bowman&executesearch=true" data-tag-key="1971316b-495e-44e8-9885-a49f84b6172c">#@kevin.bowman,

     

    Getting following error, when I am putting messages into MQ .

    DevTest Solutions 9.5.1:

    Following are the MQ header details received from Source system and trying to put the same while responding in IBM MQ native SendReceive step. If I remove "Encoding" under MQMD then I was not getting following error.

     

    Header Details:

    <Payload Version="2"><PayloadInfo type="com.ibm.mq.MQMessage"></PayloadInfo>
    <IbmMqMessage>
    <MQMD>
    <Entry key="Expiry">600</Entry>
    <Entry key="Encoding"><PayloadInfo type="java.lang.Integer"></PayloadInfo>
    <Integer>
    546</Integer>
    </Entry>
    <Entry key="CharacterSet">819</Entry>
    <Entry key="Format">MQHRF2</Entry>
    <Entry key="Priority">4</Entry>
    <Entry key="Persistence">1</Entry>
    <Entry key="MessageId">414D5120444934495230313720202020C31ACB591A810220</Entry>
    <Entry key="CorrelationId">414D512053344B4750503031202020205996523915FFBA6D</Entry>
    <Entry key="ReplyToQueueManager">VALUE</Entry>
    <Entry key="UserId">VALUE</Entry>
    <Entry key="AccountingToken">VALUE</Entry>
    <Entry key="PutApplicationType">6</Entry>
    <Entry key="PutApplicationName">VALUE</Entry>
    <Entry key="PutDateTime">VALUE</Entry>
    </MQMD>
    <Payload>
    <PayloadInfo type="[B"></PayloadInfo>
    <RFH>
    <RFH>
    <Entry key="StructLength">212</Entry>
    <Entry key="Encoding"><PayloadInfo type="java.lang.Integer"></PayloadInfo>
    <Integer>
    546</Integer>
    </Entry>
    <Entry key="CharacterSet">819</Entry>
    <Entry key="Format">MQSTR</Entry>
    <Entry key="NameValueCcsid">VALUE</Entry>
    </RFH>
    <LittleEndian>true</LittleEndian>
    <ByteAlign>true</ByteAlign>
    <Folders>
    <Entry templateKey="mcd"><mcd>
    <PayloadInfo type="java.lang.String"></PayloadInfo>
    <mcd>
    <Props>
    <Entry key="Msd">jms_text</Entry>
    </Props>
    </mcd>
    </mcd>
    </Entry>
    <Entry templateKey="jms"><jms>
    <PayloadInfo type="java.lang.String"></PayloadInfo>
    <jms>
    <Props>
    <Entry key="Dst">VALUE</Entry>
    <Entry key="Tms">1506563444022</Entry>
    <Entry key="Exp">1506563504022</Entry>
    <Entry key="Dlv">2</Entry>
    </Props>
    </jms>
    </jms>
    </Entry>
    </Folders>
    <Payload>
    <PayloadInfo type="java.lang.String"></PayloadInfo>
    <XMLString>

     

    ============================================================================
    | Completion Code 2 (MQCC_FAILED), Reason Code 2142 (MQRC_HEADER_ERROR)
    ============================================================================
    | Step:        SendResponseToGPP
    ----------------------------------------------------------------------------
    | Message:     Completion Code 2 (MQCC_FAILED), Reason Code 2142 (MQRC_HEADER_ERROR)
    ----------------------------------------------------------------------------
    | Trapped Exception: Completion Code 2 (MQCC_FAILED), Reason Code 2142 (MQRC_HEADER_ERROR)
    | Trapped Message:   

     

    ============================================================================
    | Exception:
    ============================================================================
    | Message:     Completion Code 2 (MQCC_FAILED), Reason Code 2142 (MQRC_HEADER_ERROR)
    ----------------------------------------------------------------------------
    | Trapped Exception: MQJE001: Completion Code '2', Reason '2142'.
    | Trapped Message:   com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2142'.
    ----------------------------------------------------------------------------
    STACK TRACE
    com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2142'.
        at com.ibm.mq.MQDestination.internalMQPUT(MQDestination.java:1339)
        at com.ibm.mq.MQDestination.put(MQDestination.java:1187)
        at com.itko.lisa.messaging.providers.ibmmq.IbmMqUtils.put(IbmMqUtils.java:238)
        at com.itko.lisa.messaging.providers.ibmmq.IbmMqPutOperation.doExecute(IbmMqPutOperation.java:841)
        at com.itko.lisa.messaging.providers.ibmmq.IbmMqPutOperation.doExecute(IbmMqPutOperation.java:58)
        at com.itko.lisa.asset.operation.AbstractRuntimeOperation.execute(AbstractRuntimeOperation.java:167)
        at com.itko.lisa.messaging.builder.AbstractSendReceiveOperation.doExecute(AbstractSendReceiveOperation.java:152)
        at com.itko.lisa.asset.operation.AbstractRuntimeOperation.execute(AbstractRuntimeOperation.java:167)
        at com.itko.lisa.asset.operation.AbstractOperationStep.execute(AbstractOperationStep.java:176)
        at com.itko.lisa.asset.operation.AbstractOperationStep.execute(AbstractOperationStep.java:125)
        at com.itko.lisa.test.TestNode.executeNode(TestNode.java:981)
        at com.itko.lisa.test.TestCase.execute(TestCase.java:1288)
        at com.itko.lisa.test.TestCase.execute(TestCase.java:1203)
        at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1188)
        at com.itko.lisa.editor.WalkThruPanel.prepAndExecNode(WalkThruPanel.java:1058)
        at com.itko.lisa.editor.WalkThruPanel.access$900(WalkThruPanel.java:71)
        at com.itko.lisa.editor.WalkThruPanel$10.doCallback(WalkThruPanel.java:965)
        at com.itko.util.swing.panels.ProcessingDialog$2.run(ProcessingDialog.java:194)
        at java.lang.Thread.run(Unknown Source)
    ============================================================================

     


    ----------------------------------------------------------------------------
    STACK TRACE

     


    ============================================================================
    | Exception:
    ============================================================================
    | Message:     Completion Code 2 (MQCC_FAILED), Reason Code 2142 (MQRC_HEADER_ERROR)
    ----------------------------------------------------------------------------
    | Trapped Exception: MQJE001: Completion Code '2', Reason '2142'.
    | Trapped Message:   com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2142'.
    ----------------------------------------------------------------------------
    STACK TRACE
    com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2142'.
        at com.ibm.mq.MQDestination.internalMQPUT(MQDestination.java:1339)
        at com.ibm.mq.MQDestination.put(MQDestination.java:1187)
        at com.itko.lisa.messaging.providers.ibmmq.IbmMqUtils.put(IbmMqUtils.java:238)
        at com.itko.lisa.messaging.providers.ibmmq.IbmMqPutOperation.doExecute(IbmMqPutOperation.java:841)
        at com.itko.lisa.messaging.providers.ibmmq.IbmMqPutOperation.doExecute(IbmMqPutOperation.java:58)
        at com.itko.lisa.asset.operation.AbstractRuntimeOperation.execute(AbstractRuntimeOperation.java:167)
        at com.itko.lisa.messaging.builder.AbstractSendReceiveOperation.doExecute(AbstractSendReceiveOperation.java:152)
        at com.itko.lisa.asset.operation.AbstractRuntimeOperation.execute(AbstractRuntimeOperation.java:167)
        at com.itko.lisa.asset.operation.AbstractOperationStep.execute(AbstractOperationStep.java:176)
        at com.itko.lisa.asset.operation.AbstractOperationStep.execute(AbstractOperationStep.java:125)
        at com.itko.lisa.test.TestNode.executeNode(TestNode.java:981)
        at com.itko.lisa.test.TestCase.execute(TestCase.java:1288)
        at com.itko.lisa.test.TestCase.execute(TestCase.java:1203)
        at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1188)
        at com.itko.lisa.editor.WalkThruPanel.prepAndExecNode(WalkThruPanel.java:1058)
        at com.itko.lisa.editor.WalkThruPanel.access$900(WalkThruPanel.java:71)
        at com.itko.lisa.editor.WalkThruPanel$10.doCallback(WalkThruPanel.java:965)
        at com.itko.util.swing.panels.ProcessingDialog$2.run(ProcessingDialog.java:194)
        at java.lang.Thread.run(Unknown Source)
    ============================================================================

     


        at com.itko.lisa.messaging.providers.ibmmq.IbmMqUtils.toLisaException(IbmMqUtils.java:511)
        at com.itko.lisa.messaging.providers.ibmmq.IbmMqUtils.toLisaException(IbmMqUtils.java:482)
        at com.itko.lisa.messaging.providers.ibmmq.IbmMqUtils.put(IbmMqUtils.java:245)
        at com.itko.lisa.messaging.providers.ibmmq.IbmMqPutOperation.doExecute(IbmMqPutOperation.java:841)
        at com.itko.lisa.messaging.providers.ibmmq.IbmMqPutOperation.doExecute(IbmMqPutOperation.java:58)
        at com.itko.lisa.asset.operation.AbstractRuntimeOperation.execute(AbstractRuntimeOperation.java:167)
        at com.itko.lisa.messaging.builder.AbstractSendReceiveOperation.doExecute(AbstractSendReceiveOperation.java:152)
        at com.itko.lisa.asset.operation.AbstractRuntimeOperation.execute(AbstractRuntimeOperation.java:167)
        at com.itko.lisa.asset.operation.AbstractOperationStep.execute(AbstractOperationStep.java:176)
        at com.itko.lisa.asset.operation.AbstractOperationStep.execute(AbstractOperationStep.java:125)
        at com.itko.lisa.test.TestNode.executeNode(TestNode.java:981)
        at com.itko.lisa.test.TestCase.execute(TestCase.java:1288)
        at com.itko.lisa.test.TestCase.execute(TestCase.java:1203)
        at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1188)
        at com.itko.lisa.editor.WalkThruPanel.prepAndExecNode(WalkThruPanel.java:1058)
        at com.itko.lisa.editor.WalkThruPanel.access$900(WalkThruPanel.java:71)
        at com.itko.lisa.editor.WalkThruPanel$10.doCallback(WalkThruPanel.java:965)
        at com.itko.util.swing.panels.ProcessingDialog$2.run(ProcessingDialog.java:194)
        at java.lang.Thread.run(Unknown Source)
    ============================================================================



  • 2.  Re: Getting (MQRC_HEADER_ERROR) when placing message into the queue

    Posted Sep 28, 2017 12:18 PM

    Thanks for the level of detail; I think I was able to replicate your exact message.  However, I do not get any errors when sending that message in my local environment.

     

    An 'Encoding' value of '546' is legitimate, and the documentation for MQ 2142 does not specifically mention encoding.  What is the exact version of MQ you are using?

     

    Incidentally, have you tried JMS-mode MQ?  Your message is clearly a JMS message being sent over MQ.  Using the JMS step with an IBM MQ connection factory would remove the need to worry about MQMD headers at all.



  • 3.  Re: Getting (MQRC_HEADER_ERROR) when placing message into the queue

    Posted Oct 01, 2017 07:20 PM

    Thanks for your reply Kevin.

    MQ Version: I am using MQ 8

    I have not tried JMS mode MQ's. While sending/receiving messages I need to verify SSL certificate along with SSL Sipher suite. I don't find any option to do all these activities. Could you please guide me.

    Thanks for your support in advance.

     

    Regards,

    Narasimha



  • 4.  Re: Getting (MQRC_HEADER_ERROR) when placing message into the queue

    Posted Oct 03, 2017 06:23 PM

    Create an IBM MQ Connection Factory in your configuration:

     

    Make sure the 'PRO' button is enabled.  Click the '+' button and select 'SSL' -> 'SSL Cipher Suite'.  This is the same Cipher Suite field that the IBM MQ Queue Manager asset has.

     

    Down at the bottom is the same SSL Context field that the IBM MQ Queue Manager asset has.  Configure this the same way, or you can just add an SSL Context asset:

     

    And select 'Trust Store' -> '+' -> 'Trust Manager' -> 'Trust All Manager' to build an SSL Context that trusts all certificates.

     

    Once you have this IBM MQ Connection Factory asset configured then you can create JMS Queue assets and use the JMS Send Receive step.

     

    (I took these screenshots in 10.1 but it's all there in 9.5.1)



  • 5.  Re: Getting (MQRC_HEADER_ERROR) when placing message into the queue

    Posted Oct 03, 2017 09:38 PM

    Thanks a lot for the details Kevin.

    I have created a unit test with 2 JMS Send Receive steps, one to consume the request and the second one to forward the request to other queue. Unfortunately, I am not able to send all the header parameters receiving in the request like RFH header values. I don't find any option in JMS Send Receive step to parse RFH headers like IBM Send Receive Step as follows.

     

    I will have to populate each and every header property present in the request while forwarding the request to other queue.

     

     

    Thanks,

    Narasimha



  • 6.  Re: Getting (MQRC_HEADER_ERROR) when placing message into the queue

    Posted Oct 03, 2017 11:43 PM

    What is your actual requirement for this?

     

    I looked at the RFH2 header information you provided in your original post, and it all comes from MQ's JMS layer.  For example:

    > <Entry key="Msd">jms_text</Entry>

    This is set by sending a JMS Text message


    > <Entry key="Dst">VALUE</Entry>

    This is the name of the destination queue


    > <Entry key="Tms">1506563444022</Entry>

    This is the timestamp at which the JMS message was sent

     

    > <Entry key="Exp">1506563504022</Entry>

    This is the expiration timestamp of the JMS Message


    > <Entry key="Dlv">2</Entry>

    This is the JMS Delivery Mode, set to 'Persistent' (2)

     

    Just using JMS Mode will set all of these.  I don't see anything in there that requires Native Mode and direct access to the RFH2 header.

     

    As for the MQMD headers above those:  You have access to the correlation ID through the JMS Correlation ID, and the rest through JMS custom properties.  If you use the JMS Send Receive step to receive a message and then view it on the 'Response' tab, then you can see the MQMD headers under 'Custom Properties'.

     

    The only things you can't explicitly set through JMS mode are the Message ID and the send Timestamp.  Those are always set by the JMS Provider or, in this case, the JMS layer on top of MQ. 

     

    The application sending that message is clearly a JMS application.  You should be using the same protocol to interact with it.



  • 7.  Re: Getting (MQRC_HEADER_ERROR) when placing message into the queue

    Posted Oct 04, 2017 02:12 AM

    Hi Kevin,

     

    My requirement is to consume the request from source system and modify few request attributes and forward the request to destination system along with the headers send by Source system.

     

    In this case apart from JMS headers( like JMS Destination Name, JMS Expiration, JMS TimeStamp and JMS Delivery mode) source system will be sending few more header attributes in RFH header( like Structure Length, Encoding, CharacterSet etc and few "usr" attributes. So I have created test case  as follows.

     

    1) Added JMS Send Receive Step to consume the request from source system and Checked Correlation Scheme check box and selected "JMS Correlation ID"  option from the settings button. When I run this step I can see following values in the filter

    2) Added JMS Send Receive Step to send the request to Destination system but all RFH header values are ignored as follows

    My requirement is to populate all the headers as-is present in the request.

     

    Thanks,

    Narasimha.



  • 8.  Re: Getting (MQRC_HEADER_ERROR) when placing message into the queue
    Best Answer

    Posted Oct 04, 2017 02:29 PM

    So the Correlation Scheme field in the Send Receive step only works if both sides of the step are enabled, and you're using it both send a request and receive a response.  It doesn't do what you're trying to do.

     

    If you're expecting the 'lisa.jms.Recv.*' testExec properties to be used to automatically configure your outgoing message then that's not what they do.  They are just just telling you what properties were in the incoming message.  To replicate the message and send a copy of it you have two options:

     

     (1) Resend the message verbatim using the LASTRESPONSEPAYLOAD testExec property.  Beside 'JMS Send' -> 'JMS Message', click the gear icon and select 'General' -> 'DevTest Property Reference':

     

    Under 'Property', enter LASTRESPONSEPAYLOAD:

     

     (2) Manually configure your Send step with the same parameters and properties.  The 'lisa.jms.Recv.PropertyMap.*' properties can be configured under 'Custom Properties' on the lower left. 

     

    Use the '+' button to add as may String properties as you need:

     

    If you want to resend the exact same message verbatim then you can do (1).  If you need to make some changes before forwarding then you have to do (2), and specify everything explicitly.  This is true regardless of whether you're using IBM MQ Native or JMS.



  • 9.  Re: Getting (MQRC_HEADER_ERROR) when placing message into the queue

    Posted Oct 05, 2017 08:51 PM

    Thanks Kevin. Appraoch 1 and 2 both are working.But in approach1 "PutApplicationName" and "PutApplicationDate" values are getting overridden with LISA values. Is there a possible way to override these values with the incoming values.

     

    Thanks,

    Narasimha



  • 10.  Re: Getting (MQRC_HEADER_ERROR) when placing message into the queue

    Posted Oct 06, 2017 04:28 PM

    It's no surprise that you can't set Put Date (JMS_IBM_PutDate).  The JMS specification does not allow a client to explicitly set their own message timestamp (JMS_Timestamp), and in my local testing MQ appears to tie Put Date and Put Time (JMS_IBM_PutTime) together with the JMS timestamp.

     

    It is a little surprising that you can't set Put Application Name, but it appears that the IBM MQ JMS provider reuses a JMS standard property for this: JMSXAppID.  The JMSX* properties tend to be reserved for the JMS provider's use, so the fact that you can't manually set this is also more or less following the JMS specification.  I tried pretty hard to determine exactly where the IBM MQ JMS provider gets the value for JMSXAppID; I suspect it comes from the main class used to launch the Java process.

     

    If you are required to set those properties explicitly then you cannot use JMS.  You will have to revert to IBM MQ Native, deal with all the RFH2 stuff directly, and figure out what is causing the MQ 2142 error.  I can't help you with the latter, since I'm unable to replicate this error in my environment.



  • 11.  Re: Getting (MQRC_HEADER_ERROR) when placing message into the queue

    Posted Oct 15, 2017 05:53 PM

    Thanks Kevin.