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 :

[Debutant] Hibernate + CacheException


Sujet :

Hibernate Java

  1. #1
    Membre actif
    Homme Profil pro
    Ingénieur systèmes et réseaux
    Inscrit en
    Mars 2005
    Messages
    363
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur systèmes et réseaux
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Mars 2005
    Messages : 363
    Points : 210
    Points
    210
    Par défaut [Debutant] Hibernate + CacheException
    Bonjour à tous,

    je m'attaque en ce moment au site Intranet de mon entreprise. Malheureusement, je n'ai jamais fait de dévelopement web et ce site va servir à me former sur ce sujet. Le projet a déjà été commencé par un autre. Je dois utiliser en gros les technos MySQL/Hibernate/Tomcat/JSP. Je travaille sous OS Windows et Eclipse 3.1.

    Mon problème concerne Hibernate. J'ai fait pas mal de manip' et j'ai réussi à priori à le configurer correctement (en passant par google). Malheureusement je suis face à une exception dont je n'ai pas encore trouvé la solution. Je suppose que celà vient d'un plug-in mal configuré et que ça ne vient pas forcément d'hibernate. Voici ci-dessous, les messages corrects d'Hibernate plus à la fin l'exception qui est levée à l'exécution.

    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
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
     
    0 [main] INFO org.hibernate.cfg.Environment  - Hibernate 3.1.3
    16 [main] INFO org.hibernate.cfg.Environment  - hibernate.properties not found
    31 [main] INFO org.hibernate.cfg.Environment  - using CGLIB reflection optimizer
    31 [main] INFO org.hibernate.cfg.Environment  - using JDK 1.4 java.sql.Timestamp handling
    219 [main] INFO org.hibernate.cfg.Configuration  - configuring from resource: /hibernate.cfg.xml
    219 [main] INFO org.hibernate.cfg.Configuration  - Configuration resource: /hibernate.cfg.xml
    406 [main] DEBUG org.hibernate.util.DTDEntityResolver  - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
    406 [main] DEBUG org.hibernate.util.DTDEntityResolver  - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
    406 [main] DEBUG org.hibernate.util.DTDEntityResolver  - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
    484 [main] DEBUG org.hibernate.cfg.Configuration  - hibernate.connection.driver_class=org.gjt.mm.mysql.Driver
    484 [main] DEBUG org.hibernate.cfg.Configuration  - hibernate.connection.url=jdbc:mysql://localhost/intranet_rennes
    484 [main] DEBUG org.hibernate.cfg.Configuration  - hibernate.connection.username=root
    500 [main] DEBUG org.hibernate.cfg.Configuration  - hibernate.dialect=org.hibernate.dialect.MySQLDialect
    500 [main] DEBUG org.hibernate.cfg.Configuration  - null<-org.dom4j.tree.DefaultAttribute@19efb05 [Attribute: name resource value "TAbonne.hbm"]
    500 [main] INFO org.hibernate.cfg.Configuration  - Reading mappings from resource: TAbonne.hbm
    516 [main] DEBUG org.hibernate.util.DTDEntityResolver  - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd]
    516 [main] DEBUG org.hibernate.util.DTDEntityResolver  - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
    516 [main] DEBUG org.hibernate.util.DTDEntityResolver  - unable to locate [http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd] on classpath
    516 [main] ERROR org.hibernate.util.DTDEntityResolver  - Don''t use old DTDs, read the Hibernate 3.x Migration Guide!
    2234 [main] INFO org.hibernate.cfg.HbmBinder  - Mapping class: hibernate.Abonne -> abonne
    2250 [main] DEBUG org.hibernate.cfg.HbmBinder  - Mapped property: id -> ABONNE_IDENT
    2281 [main] DEBUG org.hibernate.cfg.HbmBinder  - Mapped property: nom -> nom
    2281 [main] DEBUG org.hibernate.cfg.HbmBinder  - Mapped property: prenom -> prenom
    2281 [main] INFO org.hibernate.cfg.Configuration  - Configured SessionFactory: null
    2281 [main] DEBUG org.hibernate.cfg.Configuration  - properties: {java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, sun.boot.library.path=D:\jre1.5.0_05\bin, java.vm.version=1.5.0_05-b05, hibernate.connection.username=root, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=FR, sun.os.patch.level=Service Pack 4, java.vm.specification.name=Java Virtual Machine Specification, user.dir=D:\NLeTurluer\Sauvegarde\WorkSpace-Intranet\IntranetRennes, java.runtime.version=1.5.0_05-b05, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=D:\jre1.5.0_05\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOCUME~1\NLETUR~1\LOCALS~1\Temp\, line.separator=
    , java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows 2000, sun.jnu.encoding=Cp1252, java.library.path=D:\jre1.5.0_05\bin;.;C:\WINNT\system32;C:\WINNT;D:\Perl\bin\;C:\PROGRA~1\Borland\Delphi5\Projects\Bpl;C:\PROGRA~1\Borland\Delphi5\Bin;D:\jre1.5.0_05\bin;D:\oracle\ora92\bin;.;%PATH_BURST_GENERATION%;d:\burst\dev\scripts;d:\burst\dev\commun\bin\debug;d:\burst\dev\serveur\bin\debug;d:\burst\dev\client\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\Microsoft Visual Studio 6\Common\VSS\win32;C:\Program Files\Microsoft Visual Studio 6\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio 6\VB98;C:\mysql\bin;C:\Program Files\Microsoft Visual Studio 6\VC98\Bin;C:\Program Files\Microsoft Visual Studio 6\VC98\Include;C:\VXIpnp\WinNT\Bin;D:\cvsnt;C:\Program Files\Bitvise Tunnelier;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\UltraEdit, java.specification.name=Java Platform API Specification, java.class.version=49.0, sun.management.compiler=HotSpot Client Compiler, os.version=5.0, user.home=C:\Documents and Settings\nleturluer, user.timezone=, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.5, hibernate.connection.driver_class=org.gjt.mm.mysql.Driver, user.name=nleturluer, java.class.path=D:\Tomcat 5.5\common\lib\commons-el.jar;D:\Tomcat 5.5\common\lib\jasper-compiler-jdt.jar;D:\Tomcat 5.5\common\lib\jasper-compiler.jar;D:\Tomcat 5.5\common\lib\jasper-runtime.jar;D:\Tomcat 5.5\common\lib\jsp-api.jar;D:\Tomcat 5.5\common\lib\naming-factory-dbcp.jar;D:\Tomcat 5.5\common\lib\naming-factory.jar;D:\Tomcat 5.5\common\lib\naming-resources.jar;D:\Tomcat 5.5\common\lib\servlet-api.jar;D:\NLeTurluer\Sauvegarde\WorkSpace-Intranet\IntranetRennes\bin;D:\NLeTurluer\Sauvegarde\WorkSpace-Intranet\IntranetRennes\WebContent\WEB-INF\lib\mysql-connector-java-3.1.8-bin.jar;D:\NLeTurluer\Sauvegarde\WorkSpace-Intranet\IntranetRennes\.deployables\IntranetRennes\WEB-INF\lib\ant-antlr-1.6.5.jar;D:\NLeTurluer\Sauvegarde\WorkSpace-Intranet\IntranetRennes\.deployables\IntranetRennes\WEB-INF\lib\asm.jar;D:\NLeTurluer\Sauvegarde\WorkSpace-Intranet\IntranetRennes\.deployables\IntranetRennes\WEB-INF\lib\asm-attrs.jar;D:\NLeTurluer\Sauvegarde\WorkSpace-Intranet\IntranetRennes\.deployables\IntranetRennes\WEB-INF\lib\cglib-2.1.3.jar;D:\NLeTurluer\Sauvegarde\WorkSpace-Intranet\IntranetRennes\.deployables\IntranetRennes\WEB-INF\lib\commons-collections-2.1.1.jar;D:\NLeTurluer\Sauvegarde\WorkSpace-Intranet\IntranetRennes\.deployables\IntranetRennes\WEB-INF\lib\commons-logging-1.0.4.jar;D:\NLeTurluer\Sauvegarde\WorkSpace-Intranet\IntranetRennes\.deployables\IntranetRennes\WEB-INF\lib\dom4j-1.6.1.jar;D:\NLeTurluer\Sauvegarde\WorkSpace-Intranet\IntranetRennes\.deployables\IntranetRennes\WEB-INF\lib\hibernate3.jar;D:\NLeTurluer\Sauvegarde\WorkSpace-Intranet\IntranetRennes\.deployables\IntranetRennes\WEB-INF\lib\jta.jar;D:\NLeTurluer\Sauvegarde\WorkSpace-Intranet\IntranetRennes\.deployables\IntranetRennes\WEB-INF\lib\log4j-1.2.11.jar, java.vm.specification.version=1.0, java.home=D:\jre1.5.0_05, sun.arch.data.model=32, hibernate.dialect=org.hibernate.dialect.MySQLDialect, hibernate.connection.url=jdbc:mysql://localhost/intranet_rennes, user.language=fr, java.specification.vendor=Sun Microsystems Inc., awt.toolkit=sun.awt.windows.WToolkit, hibernate.cglib.use_reflection_optimizer=true, java.vm.info=mixed mode, sharing, java.version=1.5.0_05, java.ext.dirs=D:\jre1.5.0_05\lib\ext, sun.boot.class.path=D:\jre1.5.0_05\lib\rt.jar;D:\jre1.5.0_05\lib\i18n.jar;D:\jre1.5.0_05\lib\sunrsasign.jar;D:\jre1.5.0_05\lib\jsse.jar;D:\jre1.5.0_05\lib\jce.jar;D:\jre1.5.0_05\lib\charsets.jar;D:\jre1.5.0_05\classes, java.vendor=Sun Microsystems Inc., file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.desktop=windows, sun.cpu.isalist=}
    2281 [main] DEBUG org.hibernate.cfg.Configuration  - Preparing to build session factory with filters : {}
    2281 [main] DEBUG org.hibernate.cfg.Configuration  - processing extends queue
    2297 [main] DEBUG org.hibernate.cfg.Configuration  - processing collection mappings
    2297 [main] DEBUG org.hibernate.cfg.Configuration  - processing native query and ResultSetMapping mappings
    2297 [main] DEBUG org.hibernate.cfg.Configuration  - processing association property references
    2297 [main] DEBUG org.hibernate.cfg.Configuration  - processing foreign key constraints
    2531 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider  - Using Hibernate built-in connection pool (not for production use!)
    2531 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider  - Hibernate connection pool size: 20
    2531 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider  - autocommit mode: false
    2578 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider  - using driver: org.gjt.mm.mysql.Driver at URL: jdbc:mysql://localhost/intranet_rennes
    2578 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider  - connection properties: {user=root}
    2578 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider  - total checked-out connections: 0
    2578 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider  - opening new JDBC connection
    3156 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider  - created connection to: jdbc:mysql://localhost/intranet_rennes, Isolation Level: 4
    3172 [main] INFO org.hibernate.cfg.SettingsFactory  - RDBMS: MySQL, version: 4.1.9-max
    3172 [main] INFO org.hibernate.cfg.SettingsFactory  - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.8 ( $Date: 2005/04/14 20:36:13 $, $Revision: 1.27.4.64 $ )
    3172 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider  - returning connection to pool, pool size: 1
    3250 [main] INFO org.hibernate.dialect.Dialect  - Using dialect: org.hibernate.dialect.MySQLDialect
    3266 [main] INFO org.hibernate.transaction.TransactionFactoryFactory  - Using default transaction strategy (direct JDBC transactions)
    3281 [main] INFO org.hibernate.transaction.TransactionManagerLookupFactory  - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
    3281 [main] INFO org.hibernate.cfg.SettingsFactory  - Automatic flush during beforeCompletion(): disabled
    3281 [main] INFO org.hibernate.cfg.SettingsFactory  - Automatic session close at end of transaction: disabled
    3281 [main] INFO org.hibernate.cfg.SettingsFactory  - JDBC batch size: 15
    3281 [main] INFO org.hibernate.cfg.SettingsFactory  - JDBC batch updates for versioned data: disabled
    3297 [main] INFO org.hibernate.cfg.SettingsFactory  - Scrollable result sets: enabled
    3297 [main] DEBUG org.hibernate.cfg.SettingsFactory  - Wrap result sets: disabled
    3297 [main] INFO org.hibernate.cfg.SettingsFactory  - JDBC3 getGeneratedKeys(): enabled
    3297 [main] INFO org.hibernate.cfg.SettingsFactory  - Connection release mode: auto
    3297 [main] INFO org.hibernate.cfg.SettingsFactory  - Maximum outer join fetch depth: 2
    3297 [main] INFO org.hibernate.cfg.SettingsFactory  - Default batch fetch size: 1
    3297 [main] INFO org.hibernate.cfg.SettingsFactory  - Generate SQL with comments: disabled
    3297 [main] INFO org.hibernate.cfg.SettingsFactory  - Order SQL updates by primary key: disabled
    3297 [main] INFO org.hibernate.cfg.SettingsFactory  - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
    3313 [main] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory  - Using ASTQueryTranslatorFactory
    3313 [main] INFO org.hibernate.cfg.SettingsFactory  - Query language substitutions: {}
    3313 [main] INFO org.hibernate.cfg.SettingsFactory  - Second-level cache: enabled
    3313 [main] INFO org.hibernate.cfg.SettingsFactory  - Query cache: disabled
    3313 [main] INFO org.hibernate.cfg.SettingsFactory  - Cache provider: org.hibernate.cache.EhCacheProvider
    Exception in thread "main" java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
    	at java.lang.Class.getDeclaredConstructors0(Native Method)
    	at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    	at java.lang.Class.getConstructor0(Unknown Source)
    	at java.lang.Class.newInstance0(Unknown Source)
    	at java.lang.Class.newInstance(Unknown Source)
    	at org.hibernate.cfg.SettingsFactory.createCacheProvider(SettingsFactory.java:327)
    	at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:219)
    	at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881)
    	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174)
    	at hibernate.HibernateUtil.<clinit>(HibernateUtil.java:18)
    	at hibernate.Test.main(Test.java:18)

  2. #2
    Membre habitué Avatar de xv-mnt
    Profil pro
    Inscrit en
    Juillet 2005
    Messages
    142
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Juillet 2005
    Messages : 142
    Points : 178
    Points
    178
    Par défaut
    Par defaut, Hibernate utilise ehcache comme implementation par defaut d'un cache de second niveau. Il faut donc ajouter le jar lié à ce cache dans ton CLASSPATH.
    http://ehcache.sourceforge.net/index.html

    Si tu ne veux pas avoir de cache, ajoute cette propiété dans ton fichier de configuration :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    hibernate.cache.provider_class=org.hibernate.cache.NoCacheProvider

  3. #3
    Membre habitué Avatar de bouchette63
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    257
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2006
    Messages : 257
    Points : 187
    Points
    187
    Par défaut
    Bonjour,

    Effectivement, comme le dis xv-mnt, dans la version que tu utilises, Hibernate utilise ehCache par défaut comme cache de second niveau.
    Je te conseil donc de le désactiver dans ton fichier de configuration Hibernate :
    Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
    <property name="cache.use_second_level_cache">false</property>

    Sinon tu as ce message à un moment :
    Code X : Sélectionner tout - Visualiser dans une fenêtre à part
    516 [main] ERROR org.hibernate.util.DTDEntityResolver  - Don''t use old DTDs, read the Hibernate 3.
    Vérifie que tes balises DTD sont les versions 3.0 pour tes fichiers de mapping XML et le fichier de configuration.

  4. #4
    Membre actif
    Homme Profil pro
    Ingénieur systèmes et réseaux
    Inscrit en
    Mars 2005
    Messages
    363
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur systèmes et réseaux
    Secteur : Administration - Collectivité locale

    Informations forums :
    Inscription : Mars 2005
    Messages : 363
    Points : 210
    Points
    210
    Par défaut
    Merci bien tous les deux.

    J'ai fait ce que tu m'as dit bouchette et c'est passé.

    En ce qui concerne la DTD, j'ai mis à jour le chemin, j'ai vu l'erreur quand j'ai posté mon code.

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

Discussions similaires

  1. Réponses: 4
    Dernier message: 04/03/2009, 13h45
  2. Réponses: 1
    Dernier message: 31/07/2007, 16h16
  3. [debutant] Hibernate et Spring
    Par erwan.bodere dans le forum JSF
    Réponses: 5
    Dernier message: 23/01/2007, 05h37
  4. [Débutant]Hibernate Clés Étrangères
    Par benny7 dans le forum Hibernate
    Réponses: 5
    Dernier message: 07/08/2006, 11h05
  5. [debutant] Hibernate : table non crée
    Par lilou77 dans le forum Hibernate
    Réponses: 10
    Dernier message: 06/01/2006, 16h32

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