{"record":{"id":"187406e777d161c3","repo":"flowable/flowable-engine","slug":"systemexception-while-marking-transaction-rollback-187406","errorCode":null,"errorMessage":"SystemException while marking transaction rollback only","messagePattern":"SystemException while marking transaction rollback only","errorType":"exception","errorClass":"ActivitiException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cfg/jta/JtaTransactionContext.java","lineNumber":58,"sourceCode":"\r\n    @Override\r\n    public void commit() {\r\n        // managed transaction, ignore\r\n    }\r\n\r\n    @Override\r\n    public void rollback() {\r\n        // managed transaction, mark rollback-only if not done so already.\r\n        try {\r\n            Transaction transaction = getTransaction();\r\n            int status = transaction.getStatus();\r\n            if (status != Status.STATUS_NO_TRANSACTION && status != Status.STATUS_ROLLEDBACK) {\r\n                transaction.setRollbackOnly();\r\n            }\r\n        } catch (IllegalStateException e) {\r\n            throw new ActivitiException(\"Unexpected IllegalStateException while marking transaction rollback only\", e);\r\n        } catch (SystemException e) {\r\n            throw new ActivitiException(\"SystemException while marking transaction rollback only\", e);\r\n        }\r\n    }\r\n\r\n    protected Transaction getTransaction() {\r\n        try {\r\n            return transactionManager.getTransaction();\r\n        } catch (SystemException e) {\r\n            throw new ActivitiException(\"SystemException while getting transaction \", e);\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public void addTransactionListener(TransactionState transactionState, final TransactionListener transactionListener) {\r\n        Transaction transaction = getTransaction();\r\n        CommandContext commandContext = Context.getCommandContext();\r\n        try {\r\n            transaction.registerSynchronization(new TransactionStateSynchronization(transactionState, transactionListener, commandContext));\r\n        } catch (IllegalStateException e) {\r","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cfg/jta/JtaTransactionContext.java#L40-L76","documentation":"JtaTransactionContext.rollback() wraps javax.transaction.SystemException from Transaction.setRollbackOnly() in this ActivitiException. SystemException indicates the transaction manager itself failed (internal error, resource failure) while marking the transaction for rollback.","triggerScenarios":"Calling rollback() when the underlying JTA TransactionManager or its resources are broken — e.g. transaction manager service unavailable, recoverable internal error reported by the JTA provider.","commonSituations":"App-server transaction service failures or restarts mid-request; misconfigured XA datasource; transaction timeout leaving the manager in a broken state during engine command teardown.","solutions":["Check the application server / transaction manager logs at the correlated timestamp for the root SystemException.","Verify XA datasource and recovery configuration in the app server.","Confirm the TransactionManager lookup (e.g. JBossStandAloneJtaTransactionManager vs container lookup) is correct for your environment.","Retry the operation once the transaction service is healthy; if persistent, restart the transaction service or server."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// health-check the transaction service before commands\nUserTransaction ut = ...; ut.getStatus(); // throws early if service is broken","typeGuard":null,"tryCatchPattern":"try { engineCommand(); } catch (ActivitiException e) { if (e.getCause() instanceof SystemException) { alertOps(\"JTA transaction manager failure\"); } else { throw e; } }","preventionTips":["Monitor app-server transaction service health.","Keep XA datasource and recovery configuration valid.","Verify TransactionManager lookup matches the runtime environment."],"tags":["jta","transaction","system-exception"],"backgroundTag":"database-write-failed","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}