java.lang.ClassNotFoundException: javax.persistence.EntityListeners
Posted Fight With Me!!!
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java.lang.ClassNotFoundException: javax.persistence.EntityListeners相关的知识,希望对你有一定的参考价值。
Exception in thread "main" java.lang.NoClassDefFoundError: javax/persistence/EntityListeners at org.hibernate.cfg.annotations.reflection.JPAMetadataProvider.getDefaults(JPAMetadataProvider.java:96) at org.hibernate.annotations.common.reflection.java.JavaReflectionManager.getDefaults(JavaReflectionManager.java:226) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1385) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1856) at com.jxd.StudentTest.main(StudentTest.java:21)Caused by: java.lang.ClassNotFoundException: javax.persistence.EntityListeners at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 5 more
出错原因: 这是因为Hibernate 3.6依赖JPA,因此必须在class path 中包含一个JPA jar包。 You can find one in the Hibernate 解决方案:在class path中包含hibernate-jpa-2.0-api-1.0.0.Final.jar包即可。该包可在Hibernate-distribution-3.6.0.Final/lib/目录下找到
以上是关于java.lang.ClassNotFoundException: javax.persistence.EntityListeners的主要内容,如果未能解决你的问题,请参考以下文章