Spring boot and Hibernate Second Level cache giving NoCacheRegionFactoryAvailableException

Problem:

Setting below in application.properties,

[bash]
hibernate.cache.use_second_level_cache=true
hibernate.cache.hazelcast.use_native_client=true
hibernate.cache.region.factory_class=com.hazelcast.hibernate.HazelcastCacheRegionFactory
[/bash]

Gives the error:

[bash]

org.hibernate.cache.NoCacheRegionFactoryAvailableException: 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 class name to property
hibernate.cache.region.factory_class (and make sure the second level cache provider,
hibernate-infinispan, for example, is available in the classpath).

[/bash]

Solution

Move the above settings from application.properties to hibernate.properties.

🙂

Kj
Kj [/.] Sreekumar programs computers as a hobby and profession. Into programming from his school days, Sree uses Codemarvels to key in facts and fixes he finds interesting while working on different projects. Some of the articles here give away a few shades of his philosophical leanings too.

Leave a Comment

Your email address will not be published. Required fields are marked *