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.