IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Hibernate Java Discussion :

Aide Configuration hibernate [Core]


Sujet :

Hibernate Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Décembre 2011
    Messages
    14
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Décembre 2011
    Messages : 14
    Par défaut Aide Configuration hibernate
    Bonjour,

    Je vous explique mon problème.
    Déjà je suis novice en Hibernate.

    Je me base sur le tutoriel Java utilisant hibernate.

    J'ai modifier le projet pour en même temps utiliser maven2 comme gestionnaire de dépendances (apprend aussi à utiliser maven2).

    Voici mon pom.xml (je n'ais pas les même librairies que le tutoriel)
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
     
      <groupId>test_jpa</groupId>
      <artifactId>mon_jpa</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <packaging>war</packaging>
     
      <name>mon_jpa</name>
      <url>http://maven.apache.org</url>
     
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      </properties>
     
      <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>
     
        <!-- HIBERNATE RELATED DEPENDENCIES, INCLUDING JPA 2.0 -->
    	<dependency>
    		<groupId>org.hibernate.javax.persistence</groupId>
    		<artifactId>hibernate-jpa-2.0-api</artifactId>
    		<version>1.0.0.Final</version>
    	</dependency>
     
    	<dependency>
    		<groupId>org.hibernate</groupId>
    		<artifactId>hibernate-core</artifactId>
    		<version>3.6.10.Final</version>
    	</dependency>
     
    	<dependency>
    		<groupId>org.hibernate</groupId>
    		<artifactId>hibernate-entitymanager</artifactId>
    		<version>3.6.10.Final</version>
    	</dependency>
     
    	<dependency>
    		<groupId>org.hibernate</groupId>
    		<artifactId>hibernate-validator</artifactId>
    		<version>3.1.0.GA</version>
    	</dependency>
     
    	<!-- java bytecode processor -->
    	<dependency>
    		<groupId>javassist</groupId>
    		<artifactId>javassist</artifactId>
    		<version>3.4.GA</version>
    	</dependency>
     
    	<dependency>
    		<groupId>org.slf4j</groupId>
    		<artifactId>slf4j-simple</artifactId>
    		<version>1.6.4</version>
    		</dependency>
    	</dependencies>
     
    </project>
    Voici mon hibernate.cfg.xml (que j'ai modifier car j'ai
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    <!DOCTYPE hibernate-configuration PUBLIC
         "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
     
    <hibernate-configuration>
        <session-factory>
     
            <!--  Paramètres de connexion à la base de données -->
            <!-- <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> -->
            <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
            <property name="connection.url">jdbc:postgresql://localhost:5432/test_jpa</property>
            <property name="hibernate.connection.username">******</property>
            <property name="hibernate.connection.password">*********</property>
    		 <property name="connection.driver_class">org.postgresql.Driver</property>
     
              <property name="dialect">org.hibernate.dialect.ProgressDialect</property>
     
            <!-- Comportement pour la conservation des tables -->
            <property name="hbm2ddl.auto">create</property>
    		<property name="hibernate.show_sql">true</property>
     
            <!-- Fichiers à mapper --> 
            <mapping class="Event" />
     
        </session-factory>
    </hibernate-configuration>
    Voilà mon erreur:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    175 [main] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.2.0.Final
    185 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.6.10.Final
    187 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
    194 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
    199 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
    281 [main] INFO org.hibernate.cfg.Configuration - configuring from resource: /WEB-INF/hibernate.cfg.xml
    282 [main] INFO org.hibernate.cfg.Configuration - Configuration resource: /WEB-INF/hibernate.cfg.xml
    411 [main] WARN org.hibernate.util.DTDEntityResolver - recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
    462 [main] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
    556 [main] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: jpa.Event
    606 [main] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity jpa.Event on table events_01
    694 [main] INFO org.hibernate.validator.Version - Hibernate Validator 3.1.0.GA
    722 [main] INFO org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
    730 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
    730 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 20
    730 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false
    731 [main] ERROR org.hibernate.connection.DriverManagerConnectionProvider - JDBC Driver class not found: org.postgresql.Driver
    java.lang.ClassNotFoundException: org.postgresql.Driver
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    	at java.lang.Class.forName0(Native Method)
    	at java.lang.Class.forName(Class.java:169)
    	at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:192)
    	at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:84)
    	at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:143)
    	at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:84)
    	at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:459)
    	at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:90)
    	at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2863)
    	at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2859)
    	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870)
    	at jpa.HibernateUtils.<clinit>(HibernateUtils.java:19)
    	at jpa.InitDB.main(InitDB.java:18)
    Exception in thread "main" java.lang.ExceptionInInitializerError
    	at jpa.InitDB.main(InitDB.java:18)
    Caused by: java.lang.RuntimeException: 
     
    ________Problème de configuration : JDBC Driver class not found: org.postgresql.Driver
    	at jpa.HibernateUtils.<clinit>(HibernateUtils.java:21)
    	... 1 more
    Caused by: org.hibernate.HibernateException: JDBC Driver class not found: org.postgresql.Driver
    	at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:89)
    	at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:143)
    	at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:84)
    	at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:459)
    	at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:90)
    	at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2863)
    	at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2859)
    	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870)
    	at jpa.HibernateUtils.<clinit>(HibernateUtils.java:19)
    	... 1 more
    Caused by: java.lang.ClassNotFoundException: org.postgresql.Driver
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    	at java.lang.Class.forName0(Native Method)
    	at java.lang.Class.forName(Class.java:169)
    	at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:192)
    	at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:84)
    	... 9 more
    Apparament c'est la formation du fichier qui n'est pas bonne : recognized obsolete hibernate namespace (je ne vois pas quoi changer).

    Merci d'avance.

  2. #2
    Modérateur
    Avatar de OButterlin
    Homme Profil pro
    Inscrit en
    Novembre 2006
    Messages
    7 313
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 7 313
    Billets dans le blog
    1
    Par défaut
    Il ne trouve pas la classe org.postgresql.Driver
    Vérifie ton path
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  3. #3
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Décembre 2011
    Messages
    14
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Décembre 2011
    Messages : 14
    Par défaut
    Bonjour,

    Ha, c'est une erreur de ma pare, je doit être trop fatigué.J'étais sur d'avoir ajouter la descendance ...

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    	<dependency>
    	<groupId>postgresql</groupId>
    	<artifactId>postgresql</artifactId>
    	<version>8.4-702.jdbc4</version>
          <scope>compile</scope>
    	</dependency>
    Merci en tout cas ^^.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. configuration Hibernate et SQL server Express 2005
    Par K-Kaï dans le forum Hibernate
    Réponses: 9
    Dernier message: 28/03/2008, 18h58
  2. [tomcat] problème de configuration hibernate
    Par bastouffe dans le forum Tomcat et TomEE
    Réponses: 1
    Dernier message: 28/11/2006, 13h18
  3. [debutant] configurer hibernate sous myeclipse
    Par solawe dans le forum Hibernate
    Réponses: 3
    Dernier message: 22/11/2006, 10h36
  4. problem parsing configuration/hibernate.cfg.xml
    Par allstar dans le forum Hibernate
    Réponses: 2
    Dernier message: 25/08/2006, 07h23
  5. Configurer Hibernate pour Oracle
    Par turie dans le forum Hibernate
    Réponses: 1
    Dernier message: 29/05/2006, 15h08

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo