2

When trying to configure second level cache with hibernate 5.1.5 we are running into the following error:

Caused by: java.lang.ClassNotFoundException: org.hibernate.cache.spi.support.RegionFactoryTemplate
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_161]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_161]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338) ~[na:1.8.0_161]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_161]

Dependencies are as follows:

compile group: 'org.hibernate', name: 'hibernate-ehcache', version: '5.1.5.Final'
compile group: 'org.hibernate', name: 'hibernate-jcache', version: '5.3.1.Final'
compile group: 'org.hibernate', name: 'hibernate-core', version: '5.1.5.Final'

Some further info it gets as far as the StrategySelectorBuilder and fails when calling

applyFromStrategyRegistration( strategySelector, explicitStrategyRegistration );

where the strategyRole is interface org.hibernate.cache.spi.RegionFactory and strategyImplementation is class org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory

If we set the hibernate core and ehcache versions to 5.3.* everything works as expected.

However this is not an option as we have a grails project that needs to use hibernate and gorm on;y works with up to version 5.1.5

Any ideas would be greatly appreciated.

Thanks

1 Answer 1

1

Turns out the problem was I forgot to change the version of hibernate-jcache when I changed the version of hibernate.

The following dependencies worked correctly:

compile group: 'org.hibernate', name: 'hibernate-ehcache', version: '5.1.5.Final'
compile group: 'org.hibernate', name: 'hibernate-jcache', version: '5.2.9.Final'
compile group: 'org.hibernate', name: 'hibernate-core', version: '5.1.5.Final'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.