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 :

NoSuchMethodError sur méthode getHibernateLazyInitializer


Sujet :

Hibernate Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Inscrit en
    Mars 2007
    Messages
    179
    Détails du profil
    Informations forums :
    Inscription : Mars 2007
    Messages : 179
    Par défaut NoSuchMethodError sur méthode getHibernateLazyInitializer
    Bonjour,
    Dans mon application, je lance parfois une action qui renvoit une exception au serveur, exception que je catche. Ensuite, à chaque fois que j'essaie d'autres actions via mn application, sans avoir redemarré mon serveur, je me chope une exception hibernate du type:

    Caused by: java.lang.NoSuchMethodError:
    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
     
    com.thalys.opalys.domain.EffectivePassageImpl.getHibernateLazyInitializer()Lorg/hibernate/proxy/LazyInitializer;
    	at com.thalys.opalys.domain.EffectivePassageImpl$$EnhancerByCGLIB$$56692f02.getHibernateLazyInitializer(<generated>)
    	at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:274)
    	at org.hibernate.type.EntityType.resolve(EntityType.java:303)
    	at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116)
    	at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
    	at org.hibernate.loader.Loader.doQuery(Loader.java:717)
    	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
    	at org.hibernate.loader.Loader.loadCollection(Loader.java:1919)
    	at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
    	at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:520)
    	at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
    	at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1676)
    	at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:454)
    	at org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:755)
    	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:229)
    	at org.hibernate.loader.Loader.doList(Loader.java:2145)
    	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
    	at org.hibernate.loader.Loader.list(Loader.java:2024)
    	at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
    	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1533)
    	at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
    	at org.springframework.orm.hibernate3.HibernateTemplate$5.doInHibernate(HibernateTemplate.java:520)
    	at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:366)
    	at org.springframework.orm.hibernate3.HibernateTemplate.loadAll(HibernateTemplate.java:516)
    	at com.thalys.opalys.domain.PointDaoBase.loadAll(PointDaoBase.java:57)
    	at com.thalys.opalys.domain.PointDaoBase.loadAll(PointDaoBase.java:49)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:585)
    	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:291)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:180)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:147)
    	at org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:88)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:169)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:169)
    	at $Proxy157.loadAll(Unknown Source)
    	at com.thalys.opalys.business.AdministrationServiceImpl.handleGetAllPoints(AdministrationServiceImpl.java:83)
    	at com.thalys.opalys.business.AdministrationServiceBase.getAllPoints(AdministrationServiceBase.java:292)
    	... 63 more
    Please help, je ne comprends pas.
    Pr info j'utilise Hibernate 3.1.3.

    Nicolas.

  2. #2
    Membre éprouvé
    Profil pro
    Inscrit en
    Octobre 2005
    Messages
    961
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France

    Informations forums :
    Inscription : Octobre 2005
    Messages : 961
    Par défaut
    Peut-être une erreur d'orthographe dans le mapping d'une classe. Si vous avez une classe "EffectivePassageImpl" mappée, elle est suspecte.

  3. #3
    Membre confirmé
    Inscrit en
    Mars 2007
    Messages
    179
    Détails du profil
    Informations forums :
    Inscription : Mars 2007
    Messages : 179
    Par défaut
    Mon mapping est généré automatiquement via AndroMDA depuis un modèle UML. Il n'y a pas d'erreur connue à ce sujet (en tout cas pas jusqu'à ce matin).

    Voici mon mapping pour EffectivePassage. Je soupçonne que çà vienne de Lazy Initialization, mais je ne maitrise pas vraiment Hibernate donc...

    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
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    <?xml version="1.0" encoding="UTF-8"?>
    <!--
         Attention: Generated code! Do not modify by hand!
         Generated by: hibernate.hbm.xml.vsl in andromda-hibernate-cartridge.
      -->
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
              "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
     
    <hibernate-mapping default-cascade="none">
        <class name="com.thalys.opalys.domain.EffectivePassageImpl" table="EFFECTIVE_PASSAGE" dynamic-insert="false" dynamic-update="false">
            <id name="id" type="java.lang.Long" unsaved-value="null">
                <column name="ID" sql-type="BIGINT"/>
                <generator class="native">
                </generator>
            </id>
            <property name="passageEffective" >
                <column name="PASSAGE_EFFECTIVE" not-null="true" unique="false" sql-type="TINYINT"/>
                <type name="boolean">
                </type>
            </property>
            <property name="theoreticalComposition" >
                <column name="THEORETICAL_COMPOSITION" not-null="true" unique="false" sql-type="VARCHAR(255) BINARY"/>
                <type name="org.andromda.persistence.hibernate.usertypes.HibernateEnumType">
                     <param name="enumClassName">com.thalys.opalys.domain.CompositionType</param>
                </type>
            </property>
            <property name="effectiveComposition" >
                <column name="EFFECTIVE_COMPOSITION" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
                <type name="org.andromda.persistence.hibernate.usertypes.HibernateEnumType">
                     <param name="enumClassName">com.thalys.opalys.domain.CompositionType</param>
                </type>
            </property>
            <property name="theoreticalDate" >
                <column name="THEORETICAL_DATE" not-null="true" unique="false" sql-type="DATETIME"/>
                <type name="org.joda.time.contrib.hibernate.PersistentDateTime">
                </type>
            </property>
            <property name="effectiveDate" >
                <column name="EFFECTIVE_DATE" not-null="false" unique="false" sql-type="DATETIME"/>
                <type name="org.joda.time.contrib.hibernate.PersistentDateTime">
                </type>
            </property>
            <property name="passengersUp" >
                <column name="PASSENGERS_UP" not-null="false" unique="false" sql-type="BIGINT"/>
                <type name="java.lang.Long">
                </type>
            </property>
            <property name="passengersDown" >
                <column name="PASSENGERS_DOWN" not-null="false" unique="false" sql-type="BIGINT"/>
                <type name="java.lang.Long">
                </type>
            </property>
            <property name="passengersStill" >
                <column name="PASSENGERS_STILL" not-null="false" unique="false" sql-type="BIGINT"/>
                <type name="java.lang.Long">
                </type>
            </property>
            <property name="delay" >
                <column name="DELAY" not-null="true" unique="false" sql-type="INTEGER"/>
                <type name="int">
                </type>
            </property>
            <property name="isExternalFactor" >
                <column name="IS_EXTERNAL_FACTOR" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
                <type name="org.andromda.persistence.hibernate.usertypes.HibernateEnumType">
                     <param name="enumClassName">com.thalys.opalys.domain.ExternalFactor</param>
                </type>
            </property>
            <property name="compensationPercentage" >
                <column name="COMPENSATION_PERCENTAGE" not-null="false" unique="false" sql-type="BIGINT"/>
                <type name="java.lang.Long">
                </type>
            </property>
            <property name="totalImputation" >
                <column name="TOTAL_IMPUTATION" not-null="true" unique="false" sql-type="INTEGER"/>
                <type name="int">
                </type>
            </property>
            <property name="endOfMissionInfoPresent" >
                <column name="END_OF_MISSION_INFO_PRESENT" not-null="false" unique="false" sql-type="TINYINT"/>
                <type name="java.lang.Boolean">
                </type>
            </property>
            <property name="stationType" >
                <column name="STATION_TYPE" not-null="false" unique="false" sql-type="VARCHAR(255) BINARY"/>
                <type name="org.andromda.persistence.hibernate.usertypes.HibernateEnumType">
                     <param name="enumClassName">com.thalys.opalys.domain.StationType</param>
                </type>
            </property>
            <many-to-one name="effectiveTranche" class="com.thalys.opalys.domain.EffectiveTrancheImpl" cascade="none" foreign-key="EFFECTIVE_PASSAGE_EFFECTIVE_TC" lazy="proxy" fetch="select">
                <column name="EFFECTIVE_TRANCHE_FK" not-null="true" sql-type="BIGINT"/>
            </many-to-one>
            <many-to-one name="point" class="com.thalys.opalys.domain.ParticularPointImpl" cascade="none" foreign-key="EFFECTIVE_PASSAGE_POINT_FKC" lazy="proxy" fetch="select">
                <column name="POINT_FK" not-null="true" sql-type="BIGINT"/>
            </many-to-one>
            <many-to-one name="theoreticalLinkedTranche" class="com.thalys.opalys.domain.EffectiveTrancheImpl" cascade="none" foreign-key="EFFECTIVE_PASSAGE_THEORETICALC" lazy="proxy" fetch="select">
                <column name="THEORETICAL_LINKED_TRANCHE_FK" not-null="false" sql-type="BIGINT"/>
            </many-to-one>
            <many-to-one name="previousPassage" class="com.thalys.opalys.domain.EffectivePassageImpl" foreign-key="EFFECTIVE_PASSAGE_PREVIOUS_PAC" cascade="none" lazy="proxy" fetch="select">
                <column name="PREVIOUS_PASSAGE_FK" not-null="false" sql-type="BIGINT" unique="true"/>
            </many-to-one>
            <set name="operationalIncidents" order-by="EFFECTIVE_PASSAGE_FK" lazy="false" fetch="select" inverse="true" cascade="delete">
                <key foreign-key="EFFECTIVE_PASSAGE_ISSUE_EFFECC">
                    <column name="EFFECTIVE_PASSAGE_FK" sql-type="BIGINT"/>
                </key>
                <one-to-many class="com.thalys.opalys.domain.EffectivePassageIssueImpl"/>
            </set>
            <many-to-one name="commercialIncident" class="com.thalys.opalys.domain.IncidentImpl" cascade="none" foreign-key="EFFECTIVE_PASSAGE_COMMERCIAL_C" lazy="proxy" fetch="select">
                <column name="COMMERCIAL_INCIDENT_FK" not-null="false" sql-type="BIGINT"/>
            </many-to-one>
            <many-to-one name="trainSet" class="com.thalys.opalys.domain.TrainSetImpl" cascade="none" foreign-key="EFFECTIVE_PASSAGE_TRAIN_SET_FC" lazy="proxy" fetch="select">
                <column name="TRAIN_SET_FK" not-null="false" sql-type="BIGINT"/>
            </many-to-one>
            <many-to-one name="effectiveLinkedTranche" class="com.thalys.opalys.domain.EffectiveTrancheImpl" cascade="none" foreign-key="EFFECTIVE_PASSAGE_EFFECTIVE_LC" lazy="proxy" fetch="select">
                <column name="EFFECTIVE_LINKED_TRANCHE_FK" not-null="false" sql-type="BIGINT"/>
            </many-to-one>
        </class>
    </hibernate-mapping>
    Comme tu peux le remarquer, pour mes associations, j'ai l'attribut "lazy" à "proxy". Ca signifie quoi?

  4. #4
    Membre confirmé
    Inscrit en
    Mars 2007
    Messages
    179
    Détails du profil
    Informations forums :
    Inscription : Mars 2007
    Messages : 179
    Par défaut
    J'aimerais avoir une explication, j'ai peut être trouvé l'erreur mais ma connaissance de Hibernate étant limitée, je suis pas 100% sûr.
    J'ai trois classes: Point, ParticularPoint et EffectivePassage, à un Point est associé zéro ou plusieurs ParticularPoint. A un ParticularPoint est associé 1 et 1 point. A un EffectivePassage est associé un et un seul ParticularPoint, à un ParticularPoint est associé plusieurs EffectivePassage

    Pour Point.hbm.xml; j'ai çà pour l'association
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
            <set name="particularPoints" order-by="POINT_FK" lazy="false" fetch="select" inverse="true" cascade="delete">
                <key foreign-key="PARTICULAR_POINT_POINT_FKC">
                    <column name="POINT_FK" sql-type="BIGINT"/>
                </key>
                <one-to-many class="com.thalys.opalys.domain.ParticularPointImpl"/>
            </set>
    Pour ParticularPoint.hbm.xml, j'ai çà pour l'association
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
            <many-to-one name="point" class="com.thalys.opalys.domain.PointImpl" cascade="none" foreign-key="PARTICULAR_POINT_POINT_FKC" lazy="proxy" fetch="select">
                <column name="POINT_FK" not-null="true" sql-type="BIGINT"/>
            </many-to-one>
            <set name="effectivePassages" order-by="POINT_FK" lazy="false" fetch="select" inverse="true" cascade="delete">
                <key foreign-key="EFFECTIVE_PASSAGE_POINT_FKC">
                    <column name="POINT_FK" sql-type="BIGINT"/>
                </key>
                <one-to-many class="com.thalys.opalys.domain.EffectivePassageImpl"/>
            </set>
    Et pour EffectivePassage.hbm.xml, j'ai çà:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
            <many-to-one name="point" class="com.thalys.opalys.domain.ParticularPointImpl" cascade="none" foreign-key="EFFECTIVE_PASSAGE_POINT_FKC" lazy="proxy" fetch="select">
                <column name="POINT_FK" not-null="true" sql-type="BIGINT"/>
            </many-to-one>
    Dans ces différents mapping, j'ai des lazy proxy, et des lazy false.
    Et si on remonte dans mon stacktrace, on voit que le début de l'exception est à
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    	at com.thalys.opalys.domain.PointDaoBase.loadAll(PointDaoBase.java:57)
    Donc en gros lorsque j'essaie de charger tous les points, il se passe un souci...

    Merci d'avance pr l'aide...

  5. #5
    Membre Expert
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 276
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 276
    Par défaut
    et si tu vires le lazy = "proxy" ?

  6. #6
    Membre confirmé
    Inscrit en
    Mars 2007
    Messages
    179
    Détails du profil
    Informations forums :
    Inscription : Mars 2007
    Messages : 179
    Par défaut
    Désolé pour le temps de réponse, je ne parvenais plus à reproduire le problème et je pensais donc qu'il avait disparu, mais à ma grande joie (...) il a reparu ce matin.
    Je ne peux pas virer le "proxy", à çà deux raisons:
    1/ il s'agit de code généré
    2/ çà a toujours marché jusqu'à maintenant avec proxy...

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

Discussions similaires

  1. aide sur méthode de programmation
    Par shirya dans le forum C#
    Réponses: 1
    Dernier message: 25/02/2007, 18h48
  2. [JNI] Time out sur méthode native
    Par pierre2006 dans le forum Entrée/Sortie
    Réponses: 1
    Dernier message: 17/11/2006, 11h44
  3. [VBA-E]Erreur sur méthode de classeur
    Par vanima dans le forum Macros et VBA Excel
    Réponses: 14
    Dernier message: 20/02/2006, 12h32
  4. [C#] Aide sur méthode bloquante
    Par ArChAnGe76 dans le forum Windows Forms
    Réponses: 7
    Dernier message: 22/12/2005, 18h32
  5. Pointeur de fonctions sur méthode
    Par Glosialabolas dans le forum C++
    Réponses: 9
    Dernier message: 04/12/2005, 14h55

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