I\'m trying to configure Spring 3.2, JPA 2.0 with Hibernate 4 as the persistence provider. When I try to deploy the application in Weblogic 10.3.5, I get the following erro
Based in this maven repository, the hibernate-entitymanager-4.2.2.Final version doesn't exist. Use the 4.2.1.Final also I think you will need to add the other hibernate dependencies like hibernate-core more info about the dependencies here,
Since you get a java.lang.NoClassDefFoundError
(and not a ClassNotFoundException
), it's probably some sort of classloading issue.
It's often caused by importing in the webapp librairies (WEB-INF/lib
), JARs that are already available in the application server.
In your case, I suspect hibernate-jpa-2.0-api.jar
.
Here's two things to try :
Exclude hibernate-jpa-2.0-api.jar
from your dependencies.
OR
Add <prefer-web-inf-classes>
in the weblogic.xml
file.
Definitely some old version or not in use now hibernate jars are present there in your lib folder. I my case it was hibernate-annotations-x.x.x.jar.
I removed this hibernate-annotations-x.x.x.jar from my lib.
If you are using hibernate-commons-annotations-x.x.x.jar then no need to put above jar. I was facing the same problem and when I removed hibernate-annotations-x.x.x.jar and restarted the server then my error gone. Put only hibernate-commons-annotations-x.x.x.jar.
Search for any other old hibernate version jars, if any then remove it and put latest one.