After a transaction timeout I am repeatedly getting "Transaction is not active" with ActionStatus.ABORTED in JBoss.

Solution Verified - Updated -

Issue

  • This is the code I am using to roll back the transaction:

         try {
                session = HibernateUtil.openSession();
                session.beginTransaction();
                session.get(MyMessage.class, "1");
    
                session.getTransaction().commit();
    
            } catch (Exception e) {
                logger.error(e);
                if (session != null) {
                    try {
                        session.getTransaction().rollback();
                    } catch (Exception e1) {
                        logger.error("e1", e1);
                    }
                }
                throw e;
            } finally {
    
                try {
                    if (session != null)
                        session.close();
                } catch (Exception e1) {
                }
            }
    

If at some point a transaction times out, my thread is left with an inactive transaction and repeatedly throws the "Transaction is not active" exception.

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 5.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content