{"record":{"id":"4d421990018b6b41","repo":"hibernate/hibernate-orm","slug":"unable-to-find-transaction-manager","errorCode":null,"errorMessage":"unable to find transaction manager","messagePattern":"unable to find transaction manager","errorType":"exception","errorClass":"JndiException","httpStatus":null,"severity":"critical","filePath":"hibernate-core/src/main/java/org/hibernate/engine/transaction/jta/platform/internal/JBossAppServerJtaPlatform.java","lineNumber":38,"sourceCode":"\tpublic static final String JBOSS_UT_NAME = \"java:jboss/UserTransaction\";\n\tpublic static final String UT_NAME = \"java:comp/UserTransaction\";\n\n\t@Override\n\tprotected boolean canCacheUserTransactionByDefault() {\n\t\treturn true;\n\t}\n\n\t@Override\n\tprotected TransactionManager locateTransactionManager() {\n\t\ttry {\n\t\t\treturn (TransactionManager) jndiService().locate( AS7_TM_NAME );\n\t\t}\n\t\tcatch (JndiException jndiException) {\n\t\t\ttry {\n\t\t\t\treturn (TransactionManager) jndiService().locate( AS4_TM_NAME );\n\t\t\t}\n\t\t\tcatch (JndiException jndiExceptionInner) {\n\t\t\t\tthrow new JndiException( \"unable to find transaction manager\", jndiException );\n\t\t\t}\n\t\t}\n\t}\n\n\t@Override\n\tprotected UserTransaction locateUserTransaction() {\n\t\ttry {\n\t\t\treturn (UserTransaction) jndiService().locate( JBOSS_UT_NAME );\n\t\t}\n\t\tcatch (JndiException jndiException) {\n\t\t\ttry {\n\t\t\t\treturn (UserTransaction) jndiService().locate( UT_NAME );\n\t\t\t}\n\t\t\tcatch (JndiException jndiExceptionInner) {\n\t\t\t\tthrow new JndiException( \"unable to find UserTransaction\", jndiException );\n\t\t\t}\n\t\t}\n\t}","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/engine/transaction/jta/platform/internal/JBossAppServerJtaPlatform.java#L20-L56","documentation":"JBossAppServerJtaPlatform.locateTransactionManager() looks up the TransactionManager in JNDI, first at the AS7+ name java:jboss/TransactionManager, then at the legacy AS4 name java:/TransactionManager. When both lookups throw JndiException, Hibernate gives up with JndiException('unable to find transaction manager'): the platform is running somewhere without JBoss-style JNDI naming, or the names are not bound.","triggerScenarios":"Configuring JBossAppServerJtaPlatform outside JBoss AS/WildFly; a WildFly deployment bundling its own Hibernate so container naming/TM setup is bypassed; an explicit hibernate.transaction.jta.platform override pointing at the app-server platform in a plain JVM.","commonSituations":"Porting a WildFly app to standalone Spring Boot with Narayana but keeping the old platform property; integration tests that bootstrap Hibernate outside the container; WARs shipping hibernate-core in WEB-INF/lib instead of using the WildFly module.","solutions":["Outside JBoss/WildFly switch to JBossStandAloneJtaPlatform or NarayanaJtaPlatform (with Narayana dependencies on the classpath)","Inside WildFly remove the explicit jta.platform override so the container injects the correct platform","Remove hibernate-core from the deployment and use the Hibernate module provided by WildFly","Sanity-check new InitialContext().lookup(\"java:jboss/TransactionManager\") in the target environment"],"exampleFix":"// before: app-server platform used in a standalone JVM\nhibernate.transaction.jta.platform=org.hibernate.engine.transaction.jta.platform.internal.JBossAppServerJtaPlatform\n\n// after: standalone with Narayana on the classpath\nhibernate.transaction.jta.platform=org.hibernate.engine.transaction.jta.platform.internal.JBossStandAloneJtaPlatform","handlingStrategy":"validation","validationCode":"// must resolve when running on JBoss AS7+/WildFly\nnew javax.naming.InitialContext().lookup(\"java:jboss/TransactionManager\");\n// NamingException here means: not a JBoss naming environment -> use a standalone JtaPlatform","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use JBossAppServerJtaPlatform only inside JBoss/WildFly","For standalone Narayana set jta.platform to JBossStandAloneJtaPlatform or NarayanaJtaPlatform explicitly","Do not bundle a private hibernate-core in WildFly deployments, it defeats container platform detection","Smoke-test the JNDI names at application startup and fail with a clear message"],"tags":["jta","jndi","jboss","wildfly","transaction-manager"],"backgroundTag":"jndi-lookup-failed","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}