Reputation: 564
After grails update I got following exception:
2014-10-28 17:12:27,651 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/cache/access/AccessType
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/cache/access/AccessType
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/cache/access/AccessType
... 4 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/cache/access/AccessType
... 4 more
Caused by: java.lang.NoClassDefFoundError: org/hibernate/cache/access/AccessType
at java.lang.Class.privateGetDeclaredMethods(Class.java:2615)
at java.lang.Class.privateGetPublicMethods(Class.java:2733)
at java.lang.Class.getMethods(Class.java:1472)
... 4 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.cache.access.AccessType
at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:175)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:147)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 7 more
Grails version 2.4.3 (2.4.4), Java 1.7
BuillConfig:
runtime ':hibernate4:4.3.6.1'
runtime ":fixtures:1.3"
Config:
grails.hibernate.pass.readonly = false
grails.hibernate.osiv.readonly = false
In dependency-report only Hibernate libraries from grails-plugin-databinding & hibernate4 plugins
Any ideas?
Upvotes: 3
Views: 2349
Reputation: 75671
If you're using Hibernate 4, your DataSource.groovy is probably misconfigured. In a new 2.4.x app you'll see this in the hibernate section
:
// cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' // Hibernate 3
cache.region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory' // Hibernate 4
and you pick the one you want to use, and choose between v3 and v4 in BuildConfig.groovy. They just need to be in sync and have to agree with the version of Hibernate you want to use.
But that class is a Hibernate 3 class that's not in Hibernate 4, which implies you're either using Hibernate 3, or have another plugin that depends on Hibernate 3. Unfortunately it'll be a while before all of the popular Hibernate-related plugins have versions for 3.x and 4.x.
Upvotes: 5