Grails update 2.3.11-> 2.4.3 ClassNotFoundException: org.hibernate.cache.access.AccessType

After updating grails, I got the 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

      

Only depending on report only Hibernate libraries from grails-plugin-databinding and hibernate4 plugins

Any ideas?

+3


source to share


1 answer


If you are using Hibernate 4 your DataSource.groovy is probably misconfigured. In a new 2.4.x app, you will see this in 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 choose 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 Hibernate version you want to use.

But this class is a Hibernate 3 class that is not in Hibernate 4, which implies that you are either using Hibernate 3 or have another plugin that depends on Hibernate 3. Unfortunately, that will not be long before all the popular Hibernate related plugins have versions for 3.x and 4.x.

+5


source







All Articles