IBM Support

IT28932: NullPointerException when creating a JMSContext with a JTA UserTransaction

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

 

APAR status

  • Closed as program error.

Error description

  • The IBM MQ V9.0 resource adapter has been deployed into a
    Hitachi Application Server.  An enterprise application has also
    been deployed into the application server, and performs the
    following steps:
    
    - Start a UserTransaction.
    - Look up a connection factory from an application server's JNDI
    repository.
    - Look up a destination from the same JNDI repository.
    - Create a JMSContext from the connection factory, by calling
    the method ConnectionFactory.createContext()
    - Call the method Context.createProducer(), to create a
    JMSProducer from the JMSContext
    - Create a JMSTextMessage from the JMSContext, by calling
    Context.createTextMessage().
    - Send the JMSTextMessage to the destination using the
    JMSProducer, by calling JMSProducer.send()
    - Commit the UserTransaction.
    - Close the JMSContext.
    
    When the application runs, the attempt to create a JMSContext
    from the connection factory fails with the following exception:
    
    ************************************************************
      java.lang.NullPointerException
         at com.ibm.mq.connector.outbound.ManagedConnectionImpl.
    createTransactedNonXASession(ManagedConnectionImpl.java:803
         at
    com.ibm.mq.connector.outbound.ManagedConnectionImpl.beginLocalTr
    ansaction(ManagedConnectionImpl.java:923)
         at
    com.ibm.mq.connector.outbound.LocalTransactionImpl.begin(LocalTr
    ansactionImpl.java:92)
         at
    com.sun.enterprise.resource.ConnectorXAResource.getResourceHandl
    e(ConnectorXAResource.java:254)
         at
    com.sun.enterprise.resource.ConnectorXAResource.start(ConnectorX
    AResource.java:139)
         at
    com.sun.enterprise.transaction.JavaEETransactionManagerSimplifie
    d.enlistResource(JavaEETransactionManagerSimplified.java:386)
         ..........
    ************************************************************
    

Local fix

Problem summary

  • ****************************************************************
    USERS AFFECTED:
    This issue affects users of the IBM MQ resource adapter who have
    enterprise applications that create JMSContexts within
    UserTransactions.
    
    
    Platforms affected:
    MultiPlatform
    
    ****************************************************************
    PROBLEM DESCRIPTION:
    When an enterprise application creates a JMS ManagedConnection
    while there is an active UserTransaction, the application server
    will:
    
    - Either construct a new ManagedConnection, or return one from a
    connection pool.
    - Call the method ManagedConnection.getLocalTransaction(), to
    get a LocalTransaction object for this ManagedConnection.
    - And then call LocalTransaction.begin() to start that
    LocalTransaction.
    
    The IBM MQ resource adapter provides implementations for the
    LocalTransaction and ManagedConnection interfaces. When the
    LocalTransaction,begin() method is called by the application
    server, the IBM MQ resource adapter starts a new unit of work
    for the UserTransaction.
    
    The IBM MQ resource adapter only expected UserTransactions to be
    used with ManagedConnections that represented a JMS connection.
    When the LocalTransaction.begin() method was called, the IBM MQ
    resource adapter used the JMS connection to create a transacted
    JMS session for use within the UserTransaction. If the
    ManagedConnection was associated with a JMSContext, then there
    would be no JMS connection contained within the
    ManagedConnection, which meant that attempt to create a
    transacted JMS session from the JMS connection would fail with a
    NullPointerException.
    

Problem conclusion

  • The IBM MQ resource adapter has been updated to check whether a
    ManagedConnection is associated with either a JMS Connection or
    a JMSContext when starting a UserTransaction. If the
    ManagedConnection is associated with a JMS Connection, then the
    IBM MQ resource adapter will create a transacted JMS session for
    use with the UserTransaction. However, if the ManagedConnection
    is associated with a JMSContext, then the IBM MQ resource
    adapter will create a new transacted JMSContext for the
    UserTransaction.
    
    ---------------------------------------------------------------
    The fix is targeted for delivery in the following PTFs:
    
    Version    Maintenance Level
    v9.0 LTS   9.0.0.8
    v9.1 CD    9.1.3
    v9.1 LTS   9.1.0.4
    
    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

    IT28932

  • Reported component name

    IBM MQ BASE M/P

  • Reported component ID

    5724H7261

  • Reported release

    900

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2019-04-25

  • Closed date

    2019-07-04

  • Last modified date

    2019-07-04

  • 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

    IBM MQ BASE M/P

  • Fixed component ID

    5724H7261

Applicable component levels

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSYHRD","label":"IBM MQ"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.0","Edition":"","Line of Business":{"code":"LOB36","label":"IBM Automation"}}]

Document Information

Modified date:
04 July 2019