https://stackoverflow.com/questions/50517881/hibernate-5-3-spring-5-ehcache-3-5-2-jdk-10-hibernate-says-cache-provider-no when i start tomcat 9, jdk 10, hibernate 5.3 i get this error:
... 93 common frames omitted
aused by: java.lang.IllegalStateException: Cache provider not started
at org.hibernate.cache.spi.AbstractRegionFactory.verifyStarted(AbstractRegionFactory.java:42)
at org.hibernate.cache.spi.support.RegionFactoryTemplate.buildTimestampsRegion(RegionFactoryTemplate.java:66)
at org.hibernate.cache.internal.EnabledCaching.<init>(EnabledCaching.java:80)
at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:33)
at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:24)
at org.hibernate.service.spi.SessionFactoryServiceInitiator.initiateService(SessionFactoryServiceInitiator.java:
0)
at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.initiateService(SessionFactoryServiceRegistr
Impl.java:68)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263
so first question, do i need to start something like, ehcache or hibernate-jcache or hibernate-ehcache? i am very much interested in a KISS solution, just need to get this up and running for a 10 year old workflow app upgrading from hib 3, spring 2.5, tomcat 6 etc... ehcache from back in hib 3 works awesome for us. so i am just looking for no-harm upgrade motivated by hibernate 5.3 - that is what we need to change. so after much, much confusion about the easiest way to integrate hibernate 5.3 and ehcache, i decided on this: ivy.xml
<dependency org="org.hibernate" name="hibernate-core" rev="5.3.0.Final">
</dependency>
<dependency org="org.hibernate" name="hibernate-jcache" rev="5.3.0.Final" />
<dependency org="org.hibernate" name="hibernate-ehcache"
rev="5.3.0.Final" />
<dependency org="org.springframework.boot" name="spring-boot-starter-cache"
rev="2.0.2.RELEASE" />
<dependency org="org.ehcache" name="ehcache" rev="3.5.2" />
<dependency org="org.springframework" name="spring-orm" rev="5.0.6.RELEASE" />
<dependency org="org.springframework" name="spring-core"
rev="5.0.6.RELEASE" />
spring
<property name="hibernateProperties">
<props>
<prop key="hibernate.c3p0.acquire_increment">5</prop>
<prop key="hibernate.c3p0.idle_test_period">100</prop>
<prop key="hibernate.c3p0.max_size">20</prop>
<prop key="hibernate.c3p0.max_statements">50</prop>
<prop key="hibernate.c3p0.min_size">5</prop>
<prop key="hibernate.c3p0.timeout">300</prop>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.format_sql">false</prop>
<prop key="hibernate.use_sql_comments">false</prop>
<!-- <prop key="hibernate.enable_lazy_load_no_trans">true</prop> -->
<!-- ehcache settings -->
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.region.factory_class">org.hibernate.cache.jcache.JCacheRegionFactory</prop>
<prop key="hibernate.javax.cache.provider">org.ehcache.jsr107.EhcacheCachingProvider</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.default_cache_concurrency_strategy">read-write</prop>
<prop key="hibernate.javax.cache.uri">classpath:jcache.xml</prop>
</props>
</property>
</bean>
jcache.xml from https://hibernate.atlassian.net/browse/HHH-12531
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http: xmlns="http://www.ehcache.org/v3" xmlns:jsr107="http://www.ehcache.org/v3/jsr107"
xsi:schemaLocation="
http: http: http: http:
<!-- https:<service>
<jsr107:defaults enable-management="true" enable-statistics="true" default-template="default" />
</service>
<cache alias="org.hibernate.cache.spi.QueryResultsRegion">
<expiry>
<tti unit="seconds">300</tti>
</expiry>
<heap>1024</heap>
</cache>
<cache alias="org.hibernate.cache.spi.TimestampsRegion">
<expiry>
<none />
</expiry>
<heap>4096</heap>
</cache>
<cache-template name="default">
<expiry>
<tti unit="seconds">300</tti>
</expiry>
<heap>1024</heap>
</cache-template>
|