Saturday, June 1, 2013

What will happen when JPA jar is missing in the classpath?

JPA jar is needed when using Hibernate version 3.6.0. Missing JPA jar in the classpath will have following error. No worry, the JPA jar is bundle together with the same distribution as the Hibernate package, include it into your classpath now!!
Exception in thread "main" java.lang.NoClassDefFoundError: javax/persistence/EntityListeners
 at org.hibernate.cfg.annotations.reflection.JPAMetadataProvider.getDefaults(
 at org.hibernate.cfg.Configuration.secondPassCompile(
 at org.hibernate.cfg.Configuration.buildSessionFactory(
 at org.huahsin.MainApp.main(
Caused by: java.lang.ClassNotFoundException: javax.persistence.EntityListeners
 at Method)
 at java.lang.ClassLoader.loadClass(
 at sun.misc.Launcher$AppClassLoader.loadClass(
 at java.lang.ClassLoader.loadClass(
 ... 5 more

No comments: