-->
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.  [ 3 posts ] 
Author Message
 Post subject: problèmes avec Hibernate et Mysql
PostPosted: Mon Mar 22, 2010 5:52 am 
Newbie

Joined: Mon Mar 22, 2010 5:43 am
Posts: 3
Bonjour,

J'essaie d'insérer quelques enregistrements dans une bd Mysql, mais j'ai eu ce message d'erreur sur mon console :
Code:
Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: javax/transaction/SystemException
Exception in thread "main" java.lang.ExceptionInInitializerError
   at Utils.HibernateUtil.buildSessionFactory(HibernateUtil.java:17)
   at Utils.HibernateUtil.<clinit>(HibernateUtil.java:8)
   at Manips.Ajout.Ajout_Reservation(Ajout.java:11)
   at Manips.test.main(test.java:7)
Caused by: java.lang.NoClassDefFoundError: javax/transaction/SystemException
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1055)
   at Utils.HibernateUtil.buildSessionFactory(HibernateUtil.java:13)
   ... 3 more
Caused by: java.lang.ClassNotFoundException: javax.transaction.SystemException
   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)
   at java.lang.ClassLoader.loadClassInternal(Unknown Source)


Version d'hibernate : 3.0.1

HibernateUtil.java :
Quote:
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {

private static final SessionFactory sessionFactory = buildSessionFactory();

private static SessionFactory buildSessionFactory() {
try {
// Create the SessionFactory from hibernate.cfg.xml
return new Configuration().configure().buildSessionFactory();
} catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}

public static SessionFactory getSessionFactory() {
return sessionFactory;
}

}


mon hibernate.cfg.xml :
Quote:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">facenet</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/facenet</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.dialect">org.hibernate.dialect.DB2Dialect</property>

<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</property>
<!--<property name="hibernate.current_session_context_class">thread</property>-->

<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>


<property name="hibernate.show_sql">false</property>
<property name="hibernate.use_outer_join">true</property>
<property name="jta.UserTransaction">java:comp/UserTransaction</property>-->

<property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>

<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">none</property>

<mapping resource="Party.hbm.xml"/>
<mapping resource="Userlogin.hbm.xml"/>
<mapping resource="PartyGroup.hbm.xml"/>
<mapping resource="Person.hbm.xml"/>
<mapping resource="PartyRole.hbm.xml"/>
<mapping resource="Campany.hbm.xml"/>
<!--<mapping resource="Provider.hbm.xml"/>-->
<mapping resource="PartyClassification.hbm.xml"/>
<mapping resource="PartyClassificationGroup.hbm.xml"/>
<mapping resource="RoleType.hbm.xml"/>
<mapping resource="Marital.hbm.xml"/>
</session-factory>
</hibernate-configuration>


Je voudrai savoir s'il y a un souci de config ou une autre chose qui me pose ce problème.

Merci d'avance.


Top
 Profile  
 
 Post subject: Re: problèmes avec Hibernate et Mysql
PostPosted: Thu Apr 01, 2010 9:45 am 
Newbie

Joined: Thu Apr 01, 2010 9:01 am
Posts: 2
Bonjour,

Ton programme est lancé d'où ? Eclipse ? Ligne de commande ?
L'erreur que tu obtiens est typique d'un problème de CLASSPATH, donc rien à voir avec Hibernate :
Code:
...
Caused by: java.lang.ClassNotFoundException: javax.transaction.SystemException
...



Peux-tu donner quelques infos supplémentaires ?

Bonne journée
Ludo


Top
 Profile  
 
 Post subject: Re: problèmes avec Hibernate et Mysql
PostPosted: Tue Apr 06, 2010 8:56 am 
Beginner
Beginner

Joined: Fri Aug 24, 2007 9:47 am
Posts: 21
En effet tu as un probleme avec ton envirronement, vérifie ta version j2ee
ou sinon tu l'as avec jboss-j2ee.jar

_________________
recherche-programmeur.fr


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.