Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There are several possible solutions to this issue:

  1. Ensure that the Hibernate Cache dependency is included in the project's build path. In Maven, the dependency can be added to the POM file:
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>${hibernate.version}</version>
</dependency>
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-ehcache</artifactId>
    <version>${hibernate.version}</version>
</dependency>
  1. Ensure that the CacheProvider is correctly defined in the Hibernate configuration xml file:
<property name="hibernate.cache.provider_class">org.hibernate.cache.ehcache.internal.EhcacheCacheProvider</property>
  1. Ensure that the cache regions are correctly defined in the Hibernate configuration xml file, for example:
<cache name="com.mycompany.MyClass" maxEntriesLocalHeap="10000" maxEntriesLocalDisk="5000" eternal="false" timeToLiveSeconds="3600" />
  1. If using Spring Boot, ensure that the cache configuration properties are correctly set in the application.yml or application.properties file, for example:
spring.cache.type: ehcache
  1. Ensure that the cache implementation jar files are present in the classpath.

  2. If using Hibernate 5 or later, check if upgrading to Hibernate 5.3 or later solves the issue.

  3. Check if clearing the cache or renaming the old cache region solves the issue.

By following the above steps, one should be able to resolve the issue of being unable to generate the requested service [org.hibernate.cache.spi.CacheImplementor] for Hibernate Cache in Spring Boot.