Hibernate EntityManager 4 ClassNotFound Exception

hjunior picture hjunior · Aug 14, 2012 · Viewed 7.7k times · Source

I upgraded my application from hibernate-entitymanager-3.6.10.Final to hibernate-entitymanager-4.1.6.Final by using maven. At the application initialization phase it raised the following error;

java.lang.NoClassDefFoundError: org/hibernate/util/xml/Origin at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:55) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47) after i call Persistence.createEntityManagerFactory("OLAHA")

I looked all the jars with the release distribution. The only Origin.java/Origin.class that i could found was in org.hibernate.INTERNAL.util.xml.Origin. Whats wrong with the release?

Answer

Hunter Zhao picture Hunter Zhao · Aug 15, 2014

The reason is class org/hibernate/util/xml/Origin was removed in Hibernate 4.x, so you have to downgrade it to v.3.6.10 or upgrade all other dependencies.