hibernate/hibernate-orm · critical · JtaPlatformException

Could not obtain WebSphere Liberty transaction manager insta

Error message

Could not obtain WebSphere Liberty transaction manager instance

What it means

WebSphereLibertyJtaPlatform.locateTransactionManager() reflectively calls getTransactionManager() on com.ibm.tx.jta.TransactionManagerFactory. JtaPlatformException('Could not obtain WebSphere Liberty transaction manager instance') means the IBM transaction classes were not reachable — classic WebSphere (which needs a different platform), Liberty with classloader visibility hiding com.ibm.tx.*, or running outside WebSphere entirely.

Source

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

 * @author Andrew Guibert
 * @author Nathan Rauh
 */
public class WebSphereLibertyJtaPlatform extends AbstractJtaPlatform {

	public static final String TMF_CLASS_NAME = "com.ibm.tx.jta.TransactionManagerFactory";

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

	@Override
	protected TransactionManager locateTransactionManager() {
		try {
			return (TransactionManager) serviceRegistry().requireService( ClassLoaderService.class )
					.classForName( TMF_CLASS_NAME )
					.getMethod("getTransactionManager")
					.invoke(null);
		}
		catch ( Exception e ) {
			throw new JtaPlatformException( "Could not obtain WebSphere Liberty transaction manager instance", e );
		}
	}

	@Override
	protected UserTransaction locateUserTransaction() {
		return (UserTransaction) jndiService().locate( UT_NAME );
	}

	@Override
	public boolean canRegisterSynchronization() {
		try {
			return getCurrentStatus() == Status.STATUS_ACTIVE;
		}
		catch (SystemException x) {
			throw new RuntimeException(x);
		}
	}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Use WebSphereExtendedJtaPlatform on classic WebSphere and WebSphereLibertyJtaPlatform only on Liberty profile
  2. Set hibernate.transaction.jta.platform explicitly to the correct fully-qualified class instead of relying on auto-detection
  3. Load Hibernate through a Liberty shared library with proper visibility instead of a hidden WEB-INF copy
  4. Confirm Class.forName("com.ibm.tx.jta.TransactionManagerFactory") works from the application classloader

Example fix

// before: Liberty platform configured on classic WebSphere
hibernate.transaction.jta.platform=org.hibernate.engine.transaction.jta.platform.internal.WebSphereLibertyJtaPlatform

// after: correct platform for classic WebSphere
hibernate.transaction.jta.platform=org.hibernate.engine.transaction.jta.platform.internal.WebSphereExtendedJtaPlatform
Defensive patterns

Strategy: validation

Validate before calling

Class.forName("com.ibm.tx.jta.TransactionManagerFactory");
// must be loadable from the application classloader on Liberty

Prevention

When it happens

Trigger: WebSphereLibertyJtaPlatform configured while running on classic WAS or a non-IBM server; PARENT_LAST classloading isolating the web module from IBM classes; Hibernate bundled inside the application while the IBM transaction classes live in a server-parent classloader with restricted access.

Common situations: Apps migrated between classic WAS and Liberty keeping the wrong platform property; third-party jars forcing a jta.platform value; shared-library misconfiguration on Liberty.

Related errors


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