hibernate/hibernate-orm · error · HibernateException

Unable to instantiate proxy instance

Error message

Unable to instantiate proxy instance

What it means

Error "Unable to instantiate proxy instance" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/bytecode/internal/bytebuddy/BasicProxyFactoryImpl.java:83

	public Object getProxy() {
		final var instance = instantiateProxy();
		final var proxyConfiguration = instance.asProxyConfiguration();
		if ( proxyConfiguration == null ) {
			throw new HibernateException( "Produced proxy does not correctly implement ProxyConfiguration" );
		}
		// Create a dedicated interceptor for the proxy.
		// This is required as the interceptor is stateful.
		proxyConfiguration.$$_hibernate_set_interceptor(
				new PassThroughInterceptor( proxyClass.getName() ) );
		return instance;
	}

	private PrimeAmongSecondarySupertypes instantiateProxy() {
		try {
			return (PrimeAmongSecondarySupertypes) proxyClassConstructor.newInstance();
		}
		catch (Throwable t) {
			throw new HibernateException( "Unable to instantiate proxy instance", t );
		}
	}

	public boolean isInstance(Object object) {
		return proxyClass.isInstance( object );
	}

}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Ensure the proxied class has an accessible no-arg constructor and the ByteBuddy proxy can be defined (module opens/exports).

Example fix

Ensure the proxied class has an accessible no-arg constructor and the ByteBuddy proxy can be defined (module opens/exports).

When it happens

Trigger: Bytecode enhancement, proxy creation, or lazy interception is applied to an incompatible class or configuration.

Common situations: Build-time enhancement with module-system restrictions, mismatched Hibernate versions between build and runtime, or hibernate.bytecode.provider=none with a model that needs proxies.


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