hibernate/hibernate-orm · error · TransactionException

JTA UserTransaction.getStatus() failed

Error message

JTA UserTransaction.getStatus() failed

What it means

UserTransaction.getStatus() threw SystemException, wrapped as 'JTA UserTransaction.getStatus() failed'. Hibernate cannot read transaction state at all; like the TransactionManager variant, this signals an environment- or transaction-manager-level failure (stopped TM, stale UT handle, corrupt TM) rather than a problem with one specific transaction.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/resource/transaction/backend/jta/internal/JtaTransactionAdapterUserTransactionImpl.java:97

			}
		}
		catch (Exception e) {
			throw new TransactionException( "JTA UserTransaction.rollback() failed", e );
		}
	}

	@Override
	@Nonnull
	public TransactionStatus getStatus() {
		try {
			final var status = StatusTranslator.translate( userTransaction.getStatus() );
			if ( status == null ) {
				throw new TransactionException( "UserTransaction reported transaction status as unknown" );
			}
			return status;
		}
		catch (SystemException e) {
			throw new TransactionException( "JTA UserTransaction.getStatus() failed", e );
		}
	}

	@Override
	public void markRollbackOnly(){
		try {
			userTransaction.setRollbackOnly();
		}
		catch (SystemException e) {
			throw new TransactionException( "Unable to mark transaction for rollback only", e );
		}
	}

	@Override
	public void setTimeOut(int seconds) {
		if ( seconds > 0 ) {
			try {
				userTransaction.setTransactionTimeout( seconds );

View on GitHub (pinned to fad1729dce)

Solutions

  1. Inspect the wrapped SystemException and the TM logs
  2. Re-verify the JtaPlatform and the JNDI binding used for the UserTransaction
  3. Restart or recover the TM when it is in a terminal state
Defensive patterns

Strategy: try-catch

Validate before calling

// Health-check the UT before relying on transactions
try {
    ut.getStatus();
}
catch (SystemException e) {
    throw new IllegalStateException("UserTransaction is not usable", e);
}

Try / catch

catch (TransactionException e) {
    if ( e.getCause() instanceof SystemException ) {
        // UT/TM-level failure: surface environment health, fail fast
    }
}

Prevention

When it happens

Trigger: Any status read on the UT path - begin()'s NOT_ACTIVE check or getStatus() - while userTransaction.getStatus() throws SystemException: TM stopped, the UT bound from a dead JNDI resource, or TM corruption after a crash.

Common situations: UT handle obtained from JNDI that no longer backs a live TM; TM shutdown in progress; severe failures after a crash.

Related errors


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/ce9101933162ece7. Report an issue: GitHub.