hibernate/hibernate-orm · error · ServiceException
Unable to call constructor of RegionFactory impl [
Error message
Unable to call constructor of RegionFactory impl [
What it means
Error "Unable to call constructor of RegionFactory impl [" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/cache/internal/StrategyCreatorRegionFactoryImpl.java:45
public RegionFactory create(Class<? extends RegionFactory> strategyClass) {
assert RegionFactory.class.isAssignableFrom( strategyClass );
// first look for a constructor accepting Properties
final var regionFactoryWithProperties = instantiateWithProperties( strategyClass, Properties.class );
if ( regionFactoryWithProperties != null ) {
return regionFactoryWithProperties;
}
// next try Map
final var regionFactoryWithMap = instantiateWithProperties( strategyClass, Map.class );
if ( regionFactoryWithMap != null ) {
return regionFactoryWithMap;
}
// finally try no-arg
try {
return strategyClass.newInstance();
}
catch (IllegalAccessException | InstantiationException e) {
throw new ServiceException( "Unable to call constructor of RegionFactory impl [" + strategyClass.getName() + "]", e );
}
}
private RegionFactory instantiateWithProperties(Class<? extends RegionFactory> strategyClass, Class<?> propertiesClass) {
try {
return strategyClass.getConstructor( propertiesClass ).newInstance( properties );
}
catch ( NoSuchMethodException e ) {
return null;
}
catch (IllegalAccessException | InstantiationException | InvocationTargetException e) {
throw new ServiceException( "Unable to call constructor of RegionFactory impl [" + strategyClass.getName() + "]", e );
}
}
}
View on GitHub (pinned to fad1729dce)
Solutions
- Give the RegionFactory implementation a public no-arg (or (Properties)) constructor and inspect the wrapped cause.
Example fix
Give the RegionFactory implementation a public no-arg (or (Properties)) constructor and inspect the wrapped cause.
When it happens
Trigger: Second-level caching is misconfigured or a cache region/key does not match what Hibernate expects.
Common situations: Enabling @Cacheable entities without setting hibernate.cache.region.factory_class, custom RegionFactory implementations, or unwrapping Cache to provider types.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/86c49dd92c8b822f.
Report an issue: GitHub.