Search code examples
hibernategrails

Hibernate Jar conflicts with grails 2.0.3


I have a grails(2.0.3) application that has a jar dependency on another project which uses hibernate jars, namely:

org.hibernate:hibernate-core:4.1.0.Final

and

org.hibernate:hibernate-entitymanager:4.1.0.Final

When I run that part of code which uses these jars it encounters an exception :-

java.lang.ClassNotFoundException: org.hibernate.ejb.HibernatePersistence
    at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:156)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:128)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

It occurs like a jar conflict problem with the hibernate version that grails is using(I am not sure). How can I resolve this issue.

(It would be difficult to switch the hibernate version of the dependent project. So can I resolve this without going for that option.)


Solution

  • Fixed the issue finally by using hibernate jars with version 3.6 for the dependent application. Grails seems to be using this version. This removed the conflict issues. :-)