hibernate/hibernate-orm · critical · JndiException

unable to find transaction manager

Error message

unable to find transaction manager

What it means

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.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/engine/transaction/jta/platform/internal/JBossAppServerJtaPlatform.java:38

	public static final String JBOSS_UT_NAME = "java:jboss/UserTransaction";
	public static final String UT_NAME = "java:comp/UserTransaction";

	@Override
	protected boolean canCacheUserTransactionByDefault() {
		return true;
	}

	@Override
	protected TransactionManager locateTransactionManager() {
		try {
			return (TransactionManager) jndiService().locate( AS7_TM_NAME );
		}
		catch (JndiException jndiException) {
			try {
				return (TransactionManager) jndiService().locate( AS4_TM_NAME );
			}
			catch (JndiException jndiExceptionInner) {
				throw new JndiException( "unable to find transaction manager", jndiException );
			}
		}
	}

	@Override
	protected UserTransaction locateUserTransaction() {
		try {
			return (UserTransaction) jndiService().locate( JBOSS_UT_NAME );
		}
		catch (JndiException jndiException) {
			try {
				return (UserTransaction) jndiService().locate( UT_NAME );
			}
			catch (JndiException jndiExceptionInner) {
				throw new JndiException( "unable to find UserTransaction", jndiException );
			}
		}
	}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Outside JBoss/WildFly switch to JBossStandAloneJtaPlatform or NarayanaJtaPlatform (with Narayana dependencies on the classpath)
  2. Inside WildFly remove the explicit jta.platform override so the container injects the correct platform
  3. Remove hibernate-core from the deployment and use the Hibernate module provided by WildFly
  4. Sanity-check new InitialContext().lookup("java:jboss/TransactionManager") in the target environment

Example fix

// before: app-server platform used in a standalone JVM
hibernate.transaction.jta.platform=org.hibernate.engine.transaction.jta.platform.internal.JBossAppServerJtaPlatform

// after: standalone with Narayana on the classpath
hibernate.transaction.jta.platform=org.hibernate.engine.transaction.jta.platform.internal.JBossStandAloneJtaPlatform
Defensive patterns

Strategy: validation

Validate before calling

// must resolve when running on JBoss AS7+/WildFly
new javax.naming.InitialContext().lookup("java:jboss/TransactionManager");
// NamingException here means: not a JBoss naming environment -> use a standalone JtaPlatform

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/4d421990018b6b41. Report an issue: GitHub.