{"record":{"id":"eebd53dcc5bbc63a","repo":"Activiti/Activiti","slug":"unable-to-commit-transaction","errorCode":null,"errorMessage":"Unable to commit transaction","messagePattern":"Unable to commit transaction","errorType":"exception","errorClass":"TransactionException","httpStatus":null,"severity":"error","filePath":"activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/interceptor/JtaTransactionInterceptor.java","lineNumber":127,"sourceCode":"    }\n\n    private void doResume(Transaction tx) {\n        if (tx != null) {\n            try {\n                transactionManager.resume(tx);\n            } catch (SystemException e) {\n                throw new TransactionException(\"Unable to resume transaction\", e);\n            } catch (InvalidTransactionException e) {\n                throw new TransactionException(\"Unable to resume transaction\", e);\n            }\n        }\n    }\n\n    private void doCommit() {\n        try {\n            transactionManager.commit();\n        } catch (HeuristicMixedException e) {\n            throw new TransactionException(\"Unable to commit transaction\", e);\n        } catch (HeuristicRollbackException e) {\n            throw new TransactionException(\"Unable to commit transaction\", e);\n        } catch (RollbackException e) {\n            throw new TransactionException(\"Unable to commit transaction\", e);\n        } catch (SystemException e) {\n            throw new TransactionException(\"Unable to commit transaction\", e);\n        } catch (RuntimeException e) {\n            doRollback(true, e);\n            throw e;\n        } catch (Error e) {\n            doRollback(true, e);\n            throw e;\n        }\n    }\n\n    private void doRollback(boolean isNew, Throwable originalException) {\n        Throwable rollbackEx = null;\n        try {","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/Activiti/Activiti/blob/56435b1a97deeafdc09dd40074b056c89fba5a8a/activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/interceptor/JtaTransactionInterceptor.java#L109-L145","documentation":"doCommit() commits the newly started transaction with TransactionManager.commit(). HeuristicMixedException, HeuristicRollbackException, RollbackException, or SystemException all indicate the commit did not complete cleanly; each is wrapped in this TransactionException.","triggerScenarios":"execute() calls doCommit() after the command succeeds and transactionManager.commit() throws HeuristicMixedException, HeuristicRollbackException, RollbackException (e.g. marked rollback-only), or SystemException.","commonSituations":"A resource marked the transaction rollback-only during the command (e.g. DB constraint violation swallowed by application code); two-phase commit heuristic outcomes after resource failures; transaction timed out before commit.","solutions":["Look at the wrapped cause: RollbackException usually means rollback-only was set — find and remove the swallowed resource error","Check XA resource logs for heuristic outcomes and resolve heuristics per the transaction manager's recovery tools","Increase transaction timeouts if long commands exceed the default JTA timeout"],"exampleFix":"// before\ntry { someOperation(); } catch (Exception e) { log.warn(...); } // tx marked rollback-only silently\n// after\ntry { someOperation(); } catch (Exception e) { throw new ActivitiException(\"operation failed\", e); }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { engine.execute(cmd); } catch (TransactionException e) { Throwable c = e.getCause(); if (c instanceof RollbackException) { /* find rollback-only source */ } else { /* heuristic/system: consult TM recovery */ } }","preventionTips":["Do not swallow resource exceptions inside commands (prevents silent rollback-only)","Monitor and resolve heuristic outcomes via the transaction manager recovery service","Size JTA timeouts to command duration"],"tags":["jta","transaction","commit","activiti"],"backgroundTag":"transaction-commit-failed","analyzedSha":"56435b1a97deeafdc09dd40074b056c89fba5a8a","analyzedAt":"2026-09-09T21:00:06.703Z","contentChangedAt":"2026-09-09T21:00:06.703Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}