javax.ejb.EJBException: javax.transaction.HeuristicMixedException occurring randomly in batch process

Solution Unverified - Updated -

Issue

The following exception is seen in the batch process on most weekends and application crashes as a result.
The problem is random and not easily reproducible.
It occurs in a program with lots of transactions - each time in a different step in the program

javax.ejb.EJBException: javax.transaction.HeuristicMixedException
      at my.example.TransactionHelper.commitTx(TransactionHelper.java:39)
      at my.example.BJR.endBTX(BJR.java:738)
      at my.example.BJP.handleOneBJD(BJP.java:137)
      at my.example.BJP.run(BJP.java:233)
      at my.example.BJR.doWork(BJR.java:276)
      at my.example.BJR.start(BJR.java:1895)
      at my.example.BSBean.processJob(BSBean.java:1246)
      .. .. ..
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)
      at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
      at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:173)
      at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:77)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceIn

We are explicitly invoking commit within the transaction block. The commit block looks like

public void commit(Context pContext) {
        Statement statement = null;
        try {
            statement = dbConnection.createStatement();
            statement.executeUpdate("COMMIT");
        } catch (SQLException e) {
            .. .. ..
        } finally {
            close(statement);
        }
    }

Environment

  • JBoss Enterprise Application Platform (EAP) 5.1.0
  • Database DB2

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.