Welcome Community!
I ma trying to create a test case for HHH-5025 issue (
http://opensource.atlassian.com/project ... e/HHH-5025). However, when I'm setting "hibernate.cache.region.factory_class" property to "net.sf.ehcache.hibernate.EhCacheRegionFactory", the following error occurs:
Code:
Caused by: java.lang.NoClassDefFoundError: org/hibernate/cache/TimestampsRegion
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.getConstructor(Class.java:1657)
at org.hibernate.cfg.SettingsFactory.createRegionFactory(SettingsFactory.java:338)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:217)
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2251)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2247)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1718)
at org.hibernate.envers.test.AbstractSessionTest.init(AbstractSessionTest.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.testing.junit4.TestClassMetadata.invokeCallback(TestClassMetadata.java:196)
... 42 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.cache.TimestampsRegion
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 57 more
Of course I have declared a dependency on hibernate-ehcache project in hibernate-envers.gradle file:
Code:
testCompile( project(':hibernate-ehcache') ) {
exclude group: 'org.slf4j'
}
The following import statements might be problematic (ehcache-core-2.3.1.jar, net.sf.ehcache.hibernate.AbstractEhcacheRegionFactory):
Code:
import org.hibernate.cache.CacheDataDescription;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.CollectionRegion;
import org.hibernate.cache.EntityRegion;
import org.hibernate.cache.QueryResultsRegion;
import org.hibernate.cache.RegionFactory;
import org.hibernate.cache.Timestamper;
import org.hibernate.cache.TimestampsRegion;
import org.hibernate.cache.access.AccessType;
import org.hibernate.cfg.Settings;
Is there a task to update those imports to org.hibernate.cache.spi package?
I'm posting the question on this forum, because I've noticed that Emmanuel Bernard is one of net.sf.ehcache.hibernate.AbstractEhcacheRegionFactory class authors.
BTW is hibernate-ehcache's test suite passing in your local working directory? I'm receiving an error:
Code:
Caused by: java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
at org.slf4j.impl.Log4jLoggerAdapter.info(Log4jLoggerAdapter.java:318)
at org.hibernate.annotations.common.Version.<clinit>(Version.java:37)
at org.hibernate.annotations.common.reflection.java.JavaReflectionManager.<clinit>(JavaReflectionManager.java:73)
at org.hibernate.cfg.Configuration.createReflectionManager(Configuration.java:2356)
at org.hibernate.cfg.Configuration.createReflectionManager(Configuration.java:2352)
at org.hibernate.cfg.Configuration.reset(Configuration.java:267)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:258)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:262)
at org.hibernate.testing.junit4.BaseCoreFunctionalTestCase.constructConfiguration(BaseCoreFunctionalTestCase.java:132)
at org.hibernate.testing.junit4.BaseCoreFunctionalTestCase.buildConfiguration(BaseCoreFunctionalTestCase.java:122)
at org.hibernate.testing.junit4.BaseCoreFunctionalTestCase.buildSessionFactory(BaseCoreFunctionalTestCase.java:115)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.testing.junit4.TestClassMetadata.invokeCallback(TestClassMetadata.java:196)
Regards,
Lukasz Antoniak