Problème avec Hibernate (démarrage)
Salut
je suis encore débutante en utilisation d'hibernate, je fais donc face à un problème dont je n'arrive pas à déchirer la raison.
y'a t-il une faute dans ce code? code classe de démarrage qui inclut la création de l'objet SessionFactory
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| package util;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class HibernateUtil {
public static final SessionFactory sessionFactory;
static {
try {
sessionFactory = new Configuration()
.configure("map/hibernate.cfg.xml").buildSessionFactory();
} catch (Throwable ex) {
System.err.println("InitialSessionFactory creation failed." + ex);
}
}
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
} |
hibernate.cfg.xml
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| <?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.url">jdbc:mysql://localhost:3306/essaihibernate</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">0800752</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="current_session_context_class">thread</property>
<property name="connection.pool_size">1</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<mapping resource="map/Ecole.hbm.xml"/>
</session-factory>
</hibernate-configuration> |
sinon qu'est ce que ça veut dire cette erreur?
NB: log4j.jar est installé je l'ai mis dans /WEB-INF/lib
Code:
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
Votre aide me sera très utile, merci :)