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: 1355)
At org. hibernate. cfg. configuration. buildsessionfactory (configuration. Java: 1826)
At stufenttest. Main (stufenttest. Java: 18)
This afternoon run a simple hibernate error, using a hibernate-distribution-3.6.0.Final, can not find the error in what place, on the Internet to check.
Three statements:
(1)
When using hibernate3, we found thatProgramCompiled, always throw java. Lang. noclassdeffounderror: javax/persistence/entitylisteners exception at runtime, it is found that the ejb3-persistence.jar package is missing.
You only need to add the ejb3-persistence.jar in the class library, this exception will not occur.
What I don't understand here is hibernate3, why don't I put the ejb3-persistence.jar directly into the class library I need, rather than let the user find it, to add.
(2) version conflicts. The solution seems to be to import packages one by one.
(3)Hibernate3.6 depends on JPA. So you only need to import the JPA package,Hibernate-Distribution-3.6.0.Final/lib/JPA/Hibernate-Jpa-2.0-api-1.0.0.Final.jar.
I only used the third simple method.