hibernate/hibernate-orm · error · TransactionException
TransactionManager reported transaction status as unknwon
Error message
TransactionManager reported transaction status as unknwon
What it means
The TransactionManager overload of JtaStatusHelper.getStatus(): identical logic to the UserTransaction variant, but the status comes from TransactionManager.getStatus(). A returned STATUS_UNKNOWN means the transaction's fate is indeterminate, so Hibernate throws TransactionException. Note the message contains a typo ('unknwon'), useful when grepping logs or Hibernate sources.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/jta/JtaStatusHelper.java:65
throw new TransactionException( "Could not determine transaction status", se );
}
}
/**
* Extract the status code from the current {@link jakarta.transaction.Transaction} associated with the
* given {@link TransactionManager}
*
* @param transactionManager The {@link TransactionManager} from which to extract the status.
*
* @return The transaction status
*
* @throws TransactionException If the {@link TransactionManager} reports the status as unknown
*/
public static int getStatus(TransactionManager transactionManager) {
try {
final int status = transactionManager.getStatus();
if ( status == STATUS_UNKNOWN ) {
throw new TransactionException( "TransactionManager reported transaction status as unknwon" );
}
return status;
}
catch ( SystemException se ) {
throw new TransactionException( "Could not determine transaction status", se );
}
}
/**
* Does the given status code indicate an active transaction?
*
* @param status The transaction status code to check
*
* @return True if the code indicates active; false otherwise.
*/
public static boolean isActive(int status) {
return status == STATUS_ACTIVE;
}View on GitHub (pinned to fad1729dce)
Solutions
- Complete or let the TM finish recovery; resolve in-doubt transactions via the TM admin tooling if needed
- Fix the failing XA resource so future transactions complete deterministically
- Retry on a new transaction once TransactionManager.getStatus() returns a known code
- Verify the jta.platform setting matches the actual transaction manager
Example fix
// before
// Hibernate session/tx operation while TransactionManager reports STATUS_UNKNOWN
em.persist(order); // -> TransactionException: 'TransactionManager reported transaction status as unknwon'
// after
int status = transactionManager.getStatus();
if (status == Status.STATUS_UNKNOWN) {
awaitRecoveryThenRetry(); // or fail fast with actionable message
}
else {
em.persist(order);
} Defensive patterns
Strategy: retry
Validate before calling
int status = transactionManager.getStatus();
if (status == javax.transaction.Status.STATUS_UNKNOWN) {
throw new IllegalStateException("JTA transaction status unknown; retry after recovery");
} Try / catch
try {
// session/transaction work that inspects JTA status via TransactionManager
} catch (org.hibernate.TransactionException e) {
if (String.valueOf(e.getMessage()).contains("unknwon")) { // sic — Hibernate typo
scheduleRetry(); // wait for TM recovery, then use a new transaction
} else {
throw e;
}
} Prevention
- Resolve in-doubt transactions with the TM's administrative tools rather than retrying into them
- Keep XA resources healthy; STATUS_UNKNOWN typically follows a resource failure mid-transaction
- Probe TransactionManager.getStatus() before starting units of work in recovery-prone environments
When it happens
Trigger: Hibernate resolving current-transaction state via the TransactionManager (JTA platform lookups, transaction coordinator joins) while the manager reports STATUS_UNKNOWN — commonly during recovery after resource failure or an in-doubt transaction.
Common situations: Narayaya/Atomikos or WebLogic/WebSphere JTA recovering after a crash; XA resource (database, JMS broker) failure mid-transaction; transaction manager restart; in-doubt transactions requiring administrative resolution.
Related errors
- UserTransaction reported transaction status as unknown
- Could not obtain TransactionManager from JtaPlatform
- Problem locating/validating JTA transaction
- Could not determine transaction status
- DdlTransactionIsolatorJtaImpl could not locate TransactionMa
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/199200be87f11e4e.
Report an issue: GitHub.