-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: java.lang.NoClassDefFoundError: javax/persistence/EntityList
PostPosted: Wed May 11, 2011 11:05 am 
Newbie

Joined: Wed May 11, 2011 10:50 am
Posts: 1
Hy everyone,

I have to do a project for my studies with hibernate. So I've just tried to create a little application to see if I can insert some values in my database.


Here is my application tree :

Image

My ContactInsert.java :
Code:
package org.hibernate;

import org.hibernate.tables.Contact;
import org.hibernate.util.HibernateUtil;

public class ContactInsert {

   /**
    * @param args
    */
   public static void main(String[] args) {
      // TODO Auto-generated method stub

        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();

        Contact contact = new Contact();
        contact.setId(1);
        contact.setFirstName("bibi");
        contact.setLastName("bubu");
        contact.setEmail("bibi@bubu.fr");
        session.save(contact);

        session.getTransaction().commit();
        HibernateUtil.getSessionFactory().close();
   }

}


I have past the same HibernateUtil class as the tutorial.
When I execute my main class I get this error :

Code:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: javax/persistence/EntityListeners
Exception in thread "main" java.lang.ExceptionInInitializerError
   at org.hibernate.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:18)
   at org.hibernate.util.HibernateUtil.<clinit>(HibernateUtil.java:8)
   at org.hibernate.ContactInsert.main(ContactInsert.java:14)
Caused by: 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 org.hibernate.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:13)
   ... 2 more
Caused by: java.lang.ClassNotFoundException: javax.persistence.EntityListeners
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 7 more



Can you please help me.
Many thanks


Top
 Profile  
 
 Post subject: Re: java.lang.NoClassDefFoundError: javax/persistence/EntityList
PostPosted: Mon Jan 21, 2013 7:56 am 
Newbie

Joined: Mon Jan 21, 2013 7:54 am
Posts: 1
In this Web I found the solution
http://technicalrecyclebin.wordpress.com/category/j2ee/hibernate/

Solution:
Place the JPA jar file
For example: hibernate-jpa-2.0-api-1.0.0.Final.jar


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.