I'm programming a project in which I need Hibernate technology. I got this stack trace and I don't know how to fix it. Any help please ?
Here is my stack trace, I got these two errors :
SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding. SLF4J: Your binding is version 1.5.5 or earlier. SLF4J: Upgrade your binding to version 1.6.x. or 2.0.x
Here is my HibernateUtils.class
package com.forum.utils;
import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.AnnotationConfiguration;
public class HibernateUtils { private static final SessionFactory sessionFactory;
// Crée une unique instance de la SessionFactory à partir de // hibernate.cfg.xml static { try { sessionFactory = new AnnotationConfiguration().configure() .buildSessionFactory(); } catch (HibernateException ex) { throw new RuntimeException("Problème de configuration : " + ex.getMessage(), ex); } }
// Renvoie une session Hibernate public static Session getSession() throws HibernateException { return sessionFactory.openSession(); } }
This error triggers from this line :
s = HibernateUtils.getSession();
hibernate.cfg.xml :
<?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="connection.driver_class">org.postgresql.Driver</property> <property name="connection.url">jdbc:postgresql://localhost:5432/projetForum</property> <property name="connection.username">postgres</property> <property name="connection.password">esct</property> <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property> <!-- Comportement pour la conservation des tables --> <property name="hbm2ddl.auto">update</property> <!-- Activation : affichage en console, commentées et formatées --> <property name="show_sql">true</property> <property name="hibernate.format_sql">true</property> <property name="use_sql_comments">true</property> <!-- Fichiers à mapper --> <mapping class="com.forum.beans.Utilisateur" /> <mapping class="com.forum.beans.Topic" /> </session-factory> </hibernate-configuration>
Here is Hibernate3.0 library and my jstl jars :