IBM Support

IV09196: CALLING 'JMSBYTESMESSAGE.GETBODYLENGTH()' ON A DESERIALIZED JMSBYTESMESSAGE IN WMQ V7 JMS CLASSES RETURNS A JMSCC0046 ERROR

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • A JMS application consuming a message receives the exception:
    
    com.ibm.msg.client.jms.DetailedMessageNotReadableException
    
    containing the following information:
    
    JMSCC0046: It is not permitted to call method 'getBodyLength'
    on the message because the message body is write-only. A user
    application has attempted to read a write-only message body.
    Change the application program to remove this behavior, or call
    the reset() method first.
    
    
    This exception is due to the state of this JMSBytesMessage
    being "write-only", which results in the method:
    
    JMSBytesMessage.getBodyLength()
    
    method returning an exception containing the JMSCC0046 error
    message.
    

Local fix

Problem summary

  • ****************************************************************
    USERS AFFECTED:
    This issue affects users of:
    
    - The WebSphere MQ V7 classes for JMS.
    - The WebSphere MQ V7 Resource Adapter.
    - The WebSphere Application Server V7 WebSphere MQ messaging
    provider.
    - The WebSphere Application Server V8 WebSphere MQ messaging
    provider.
    - The WebSphere Application Server V6.1 WebSphere MQ messaging
    provider who have configured the WebSphere variable
    MQ_INSTALL_ROOT to point to a WebSphere MQ V7 installation.
    
    who have applications that deserialize JMSBytesMessage objects.
    
    Platforms affected:
    All Distributed (iSeries, all Unix and Windows) +Java +Java zOS
    ****************************************************************
    PROBLEM SUMMARY:
    The body of a JMSBytesMessage will either be in read-only or
    write-only mode.
    
    When the message body is in read-only mode, data can only be
    read from the body. No new data can be written to the message
    body until the message is put into write-only mode.
    
    If the message body is in write-only mode, data can only be
    written to the body. Data cannot be read from the message body
    until it is put into read-only mode.
    
    When a JMSBytesMessage is first created, or when the
    clearBody() method has been called on the message, the body of
    the message is in write-only mode.  After the first call to the
    reset() method has been made, the message is in read-only mode.
    When a message has been sent, the provider always calls reset
    to read its content.  Likewise, when a message has been
    received, the provider calls reset so that the message is in
    read-only mode for the client.
    
    If clearBody() is called on a message in read-only mode, the
    message body is cleared and the message is in write-only mode.
    
    
    When an application using the WebSphere MQ V6 classes for JMS
    or the WebSphere MQ V6 Resource Adapter deserialized a
    JMSBytesMessage, the message body of the deserialized message
    was always in read-only mode. This allowed applications to call
    the following methods on the message as soon as it had been
    deserialized:
    
    * boolean readBoolean()
    * byte readByte()
    * int readBytes(byte[])
    * int readBytes(byte[], int)
    * char readChar()
    * double readDouble()
    * float readFloat()
    * int readInt()
    * long readLong()
    * short readShort()
    * int readUnsignedByte()
    * int readUnsignedShort()
    * String readUTF()
    
    However, when an application using either the WebSphere MQ V7
    classes for JMS or the WebSphere MQ V7 Resource Adapter
    deserialized a JMSBytesMessage, the message body of the
    deserialized message was always in write-only mode.
    
    This caused issues for applications that had migrated from the
    WebSphere MQ V6 classes for JMS to the WebSphere MQ V7 classes
    for JMS, or from the WebSphere MQ V6 Resource Adapter to the
    WebSphere MQ V7 Resource Adapter.
    
    Because the message body of the deserialized JMSBytesMessage
    was no longer in read-only mode, applications had to be
    modified to call the method:
    
    JMSBytesMessage.reset()
    
    on the deserialized JMSBytesMessage to put the message body
    into read-only mode before they could work with either the
    WebSphere MQ V7 classes for JMS or the WebSphere MQ V7 Resource
    Adapter.
    

Problem conclusion

  • The WebSphere MQ V7 classes for JMS and the WebSphere MQ V7
    Resource Adapter have been updated to allow users to specify if
    the message body for deserialized JMSBytesMessages should be in
    read-only or write-only mode.
    
    The default behaviour of the WebSphere MQ V7 classes for JMS
    and the WebSphere MQ V7 Resource Adapter is to ensure that
    deserialized JMSBytesMessages have their message body in write-
    only mode.
    
    This behaviour can be changed, so that the message body for
    deserialized JMSBytesMessages is in read-only mode (thereby
    matching the WebSphere MQ V6 classes for JMS behaviour), by
    setting the property:
    
    com.ibm.jms.forceDeserializedJMSBytesMessagesToReadOnlyMode
    
    to the value:
    
    true
    
    To use the property, a Java application needs to be started
    with the following Java system property:
    
      -Dcom.ibm.jms.forceDeserializedJMSBytesMessagesToReadOnlyMode=
    true
    
    For example, to start a Java application called myJavaApp
    with this property set, run the command:
    
    java
    -Dcom.ibm.jms.forceDeserializedJMSBytesMessagesToReadOnlyMode=
    true myJavaApp
    
    ---------------------------------------------------------------
    The fix is targeted for delivery in the following PTFs:
    
                       v7.0
    Platform           Fix Pack 7.0.1.8
    --------           --------------------
    Windows            U200335
    AIX                U845856
    HP-UX (PA-RISC)    U847965
    HP-UX (Itanium)    U847970
    Solaris (SPARC)    U847966
    Solaris (x86-64)   U847972
    iSeries            7.0.1.8
    Linux (x86)        U847967
    Linux (x86-64)     U847971
    Linux (zSeries)    U847968
    Linux (Power)      U847969
    zOS                7.0.1.8
    
                       v7.1
    Platform           Fix Pack 7.1.0.1
    --------           --------------------
    Windows            7.1.0.1
    AIX                7.1.0.1
    HP-UX (PA-RISC)    7.1.0.1
    HP-UX (Itanium)    7.1.0.1
    Solaris (SPARC)    7.1.0.1
    Solaris (x86-64)   7.1.0.1
    iSeries            7.1.0.1
    Linux (x86)        7.1.0.1
    Linux (x86-64)     7.1.0.1
    Linux (zSeries)    7.1.0.1
    Linux (Power)      7.1.0.1
    zOS                7.1.0.1
    
    The latest available maintenance can be obtained from
    'WebSphere MQ Recommended Fixes'
    http://www-1.ibm.com/support/docview.wss?rs=171&uid=swg27006037
    
    If the maintenance level is not yet available information on
    its planned availability can be found in 'WebSphere MQ
    Planned Maintenance Release Dates'
    http://www-1.ibm.com/support/docview.wss?rs=171&uid=swg27006309
    ---------------------------------------------------------------
    

Temporary fix

Comments

APAR Information

  • APAR number

    IV09196

  • Reported component name

    WMQ AIX V7

  • Reported component ID

    5724H7221

  • Reported release

    701

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2011-10-14

  • Closed date

    2011-11-29

  • Last modified date

    2013-08-08

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    WMQ AIX V7

  • Fixed component ID

    5724H7221

Applicable component levels

  • R701 PSY

       UP

[{"Line of Business":{"code":"LOB45","label":"Automation"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSFKSJ","label":"WebSphere MQ"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7.0.1"}]

Document Information

Modified date:
03 October 2021