In the JBoss EAP why am I getting the exception Transaction is not active ?

Solution Unverified - Updated -

Issue

  • A session bean is invoking its own method (called secondMethod) annotated with @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW). If an exception occurring inside secondMethod, it should not compromise the transaction of the calling method (called rootMethod). However this is not the case, rollback is getting triggered:

    Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection
            ... 37 more
    Caused by: org.jboss.util.NestedSQLException: Transaction is not active:
    tx=TransactionImple < ac, BasicAction: aa266fb:e81f:4b74a03b:11f26e
    status: ActionStatus.ABORT_ONLY >; - nested throwable:
    (javax.resource.ResourceException: Transaction is not active:
    tx=TransactionImple < ac, BasicAction: aa266fb:e81f:4b74a03b:11f26e
    status: ActionStatus.ABORT_ONLY >)
            at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:96)
            at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)
            at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
            ... 50 more
    Caused
    by: javax.resource.ResourceException: Transaction is not active:
    tx=TransactionImple < ac, BasicAction: aa266fb:e81f:4b74a03b:11f26e
    status: ActionStatus.ABORT_ONLY >
            at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:319)
            at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:403)
            ... 52 more
    

Environment

  • Enterprise Application Platform (EAP)
    • 4.3 CP02
  • Session Bean is as follow (Specifically for this exception with Remote EJBs)

    @Stateless
    public class ManagerBean  implements ManagerBeanRemote{
      @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
      public void rootMethod() { 
        ...
        result = secondMethod();     
        ...
      }
    
      @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
      private Object secondMethod() {
        ...; 
      }
      ...
    }
    
  • Superclass to a @Name Seam component contains a method(s) which does not define @Transactional or join the transaction

    public E update(E entity) throws SomeException {
    
        beforeUpdate(entity);
    
        if (!isManaged(entity)) {
    
            entity = getEntityManager().merge(entity);
    
        }
    
        getEntityManager().flush();
    
        return entity;
    
    }
    

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.