{"record":{"id":"50a2235de5d1eb10","repo":"flowable/flowable-engine","slug":"systemexception-while-getting-transaction-50a223","errorCode":null,"errorMessage":"SystemException while getting transaction ","messagePattern":"SystemException while getting transaction ","errorType":"exception","errorClass":"ActivitiException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cfg/jta/JtaTransactionContext.java","lineNumber":66,"sourceCode":"        // 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\n            throw new ActivitiException(\"IllegalStateException while registering synchronization \", e);\r\n        } catch (RollbackException e) {\r\n            throw new ActivitiException(\"RollbackException while registering synchronization \", e);\r\n        } catch (SystemException e) {\r\n            throw new ActivitiException(\"SystemException while registering synchronization \", e);\r\n        }\r\n    }\r\n\r","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cfg/jta/JtaTransactionContext.java#L48-L84","documentation":"JtaTransactionContext.getTransaction() delegates to the configured TransactionManager.getTransaction(). A javax.transaction.SystemException from the manager (failed to determine current transaction) is wrapped in this ActivitiException. It means the engine could not obtain the current JTA transaction at all.","triggerScenarios":"Any code path that resolves the current transaction — rollback(), addTransactionListener(), or transaction() (the TransactionContext factory method) — when TransactionManager.getTransaction() throws SystemException.","commonSituations":"Wrong TransactionManager implementation injected into the JTA configuration (e.g. standalone manager in a container), transaction service not started, or engine commands executed outside a supported JTA environment.","solutions":["Inspect the wrapped SystemException cause for the transaction manager's root failure.","Verify the configured TransactionManager matches your runtime (container JNDI lookup vs standalone JTA like JBossSTM / Atomikos).","Ensure the engine is configured with JtaProcessEngineConfiguration (or correct Spring/Tomcat JTA config) so a valid TransactionManager is set.","Check that the transaction service is up and that no earlier transaction failure left the manager unusable."],"exampleFix":"// before\nProcessEngineConfiguration.createProcessEngineConfigurationFromResource(\"activiti.cfg.xml\");\n// after (JTA environment)\nJtaProcessEngineConfiguration cfg = new JtaProcessEngineConfiguration();\ncfg.setTransactionManager(transactionManager);","handlingStrategy":"validation","validationCode":"if (transactionManager == null) throw new IllegalStateException(\"JTA TransactionManager not configured\");","typeGuard":null,"tryCatchPattern":"try { engineCommand(); } catch (ActivitiException e) { if (e.getCause() instanceof SystemException && e.getMessage().contains(\"getting transaction\")) { failFast(\"engine cannot resolve current JTA transaction\"); } else { throw e; } }","preventionTips":["Configure JtaProcessEngineConfiguration with a valid TransactionManager.","Run engine commands only inside an active JTA context.","Smoke-test the JTA setup at startup with a no-op transactional command."],"tags":["jta","transaction","system-exception"],"backgroundTag":"invalid-config-value","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"}