hibernate/hibernate-orm · critical · JtaPlatformException

Could not obtain WildFly Transaction Client user transaction

Error message

Could not obtain WildFly Transaction Client user transaction instance

What it means

The UserTransaction counterpart on WildFlyStandAloneJtaPlatform: locateUserTransaction() reflectively calls getInstance() on org.wildfly.transaction.client.LocalUserTransaction and throws JtaPlatformException('Could not obtain WildFly Transaction Client user transaction instance') when the client library is absent or that class cannot be invoked. Hibernate then cannot supply a UserTransaction for the standalone WildFly transaction setup.

Source

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

					.invoke( null );
		}
		catch (Exception e) {
			throw new JtaPlatformException(
					"Could not obtain WildFly Transaction Client transaction manager instance",
					e
			);
		}
	}

	@Override
	protected UserTransaction locateUserTransaction() {
		try {
			return (UserTransaction) serviceRegistry()
					.requireService( ClassLoaderService.class )
					.classForName( WILDFLY_UT_CLASS_NAME ).getMethod( "getInstance" ).invoke( null );
		}
		catch (Exception e) {
			throw new JtaPlatformException(
					"Could not obtain WildFly Transaction Client user transaction instance",
					e
			);
		}
	}
}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Add or repair org.wildfly.transaction.client:wildfly-transaction-client
  2. Verify the class is present: Class.forName("org.wildfly.transaction.client.LocalUserTransaction")
  3. Align client and Narayana versions, or fall back to NarayanaJtaPlatform
  4. Keep hibernate.transaction.jta.platform explicit in standalone deployments

Example fix

// before (pom.xml): client jar missing or incomplete
// after (pom.xml):
<dependency>
    <groupId>org.wildfly.transaction.client</groupId>
    <artifactId>wildfly-transaction-client</artifactId>
    <version>2.0.1.Final</version>
</dependency>
Defensive patterns

Strategy: validation

Validate before calling

Class.forName("org.wildfly.transaction.client.LocalUserTransaction");
// the exact class WildFlyStandAloneJtaPlatform invokes for the UT

Prevention

When it happens

Trigger: Missing org.wildfly.transaction.client:wildfly-transaction-client (the LocalUserTransaction class specifically); partial shading that keeps ContextTransactionManager but drops the local UT class; a client version too old to expose LocalUserTransaction.getInstance().

Common situations: Same deployment shape as the TM variant: standalone Spring/Narayana setups where the WildFly transaction client is half-present or version-skewed.

Related errors


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