Java. Lang. noclassdeffounderror: javax/persistence/entitylisteners Solution

Source: Internet
Author: User
Document directory
  • Environment
  • Problem
  • Solution
  • References
Environment

MySQL 5.1 + hibernate 3.2 + myeclipse 8.6

 

Problem

When you use hibernate to insert data, the following exception is reported:

 

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".SLF4J: Defaulting to no-operation (NOP) logger implementationSLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.Exception in thread "main" java.lang.NoClassDefFoundError: javax/persistence/EntityListenersat 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.oracle.entities.Test.main(Test.java:53)Caused by: java.lang.ClassNotFoundException: javax.persistence.EntityListenersat java.net.URLClassLoader$1.run(URLClassLoader.java:200)at java.security.AccessController.doPrivileged(Native Method)at java.net.URLClassLoader.findClass(URLClassLoader.java:188)at java.lang.ClassLoader.loadClass(ClassLoader.java:307)at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)at java.lang.ClassLoader.loadClass(ClassLoader.java:252)at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)... 5 more

 

Solution

Hibernate requires JPA support, import JPA jar package (hibernate-jpa-2.0-api-1.0.1.Final.jar.

 

 

References

Http://javapub.iteye.com/blog/869380

 

 
@ Wentasy blog is for your reference only. Welcome to visit. I hope to criticize and correct any mistakes. If you need to repost the original blog post, please indicate the source. Thank you for the [csdn blog]

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.