hibernate/hibernate-orm · error · NoCacheRegionFactoryAvailableException

Second-level cache is used in the application, but property

Error message

Second-level cache is used in the application, but property hibernate.cache.region.factory_class is not given; please either disable second-level cache or set correct region factory using the hibernate.cache.region.factory_class setting and make sure the second-level cache provider (hibernate-infinispan, e.g.) is available on the classpath.

What it means

Error "Second-level cache is used in the application, but property hibernate.cache.region.factory_class is not given; please either disable second-level cache or set correct region factory using the hibernate.cache.region.factory_class setting and make sure the second-level cache provider (hibernate-infinispan, e.g.) is available on the classpath." thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/cache/internal/NoCachingRegionFactory.java:84

	}

	@Override
	public long nextTimestamp() {
		return System.currentTimeMillis();
	}

	@Override
	@Nonnull
	public CacheTransactionSynchronization createTransactionContext(@Nonnull SharedSessionContractImplementor session) {
		return NoCachingTransactionSynchronizationImpl.INSTANCE;
	}

	@Override
	@Nonnull
	public DomainDataRegion buildDomainDataRegion(
			@Nonnull DomainDataRegionConfig regionConfig,
			@Nonnull DomainDataRegionBuildingContext buildingContext) {
		throw new NoCacheRegionFactoryAvailableException();
	}

	@Override
	@Nonnull
	public QueryResultsRegion buildQueryResultsRegion(
			@Nonnull String regionName,
			@Nonnull SessionFactoryImplementor sessionFactory) {
		throw new NoCacheRegionFactoryAvailableException();
	}

	@Override
	@Nonnull
	public TimestampsRegion buildTimestampsRegion(
			@Nonnull String regionName,
			@Nonnull SessionFactoryImplementor sessionFactory) {
		throw new NoCacheRegionFactoryAvailableException();
	}
}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Set hibernate.cache.region.factory_class (e.g. org.hibernate.cache.jcache.JCacheRegionFactory or infinispan) and add the cache provider to the classpath, or disable the second-level cache.

Example fix

Set hibernate.cache.region.factory_class (e.g. org.hibernate.cache.jcache.JCacheRegionFactory or infinispan) and add the cache provider to the classpath, or disable the second-level cache.

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/57918d057429459a. Report an issue: GitHub.