Hibernate: javax/persistence/entitylisteners

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.