nested exception is java.lang.NoClassDefFoundError: org/hibernate/ejb/HibernatePersistence

前端 未结 3 1846
忘了有多久
忘了有多久 2021-01-12 18:54

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

相关标签:
3条回答
  • 2021-01-12 19:15

    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,

    0 讨论(0)
  • 2021-01-12 19:25

    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.

    0 讨论(0)
  • 2021-01-12 19:35

    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.

    0 讨论(0)
提交回复
热议问题