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 :

Exécution qui bloque


Sujet :

Hibernate Java

  1. #1
    Membre averti
    Inscrit en
    Décembre 2010
    Messages
    39
    Détails du profil
    Informations forums :
    Inscription : Décembre 2010
    Messages : 39
    Par défaut Exécution qui bloque
    Bonjour,

    J’ai développé une application qui utilise Hibernate.

    Ma configuration Hibernate est :
    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
    <?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.dialect">org.hibernate.dialect.OracleDialect</property>
            <property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
            <property name="hibernate.connection.url">jdbc:oracle:thin:@10.40.30.8:1521:PXPR</property>
            <property name="current_session_context_class">thread</property>
            <property name="hibernate.show_sql">false</property>
            <property name="hibernate.connection.username">rhuser</property>
            <property name="hibernate.connection.password">base</property>   
     
            <mapping class="db.entites.ReManager"/>
            <mapping class="db.entites.Projets"/>
            <mapping class="db.entites.ReEmp"/>
            <mapping class="db.entites.ReParametres"/>
            <mapping class="db.entites.Taches"/>
            <mapping class="db.entites.EmpProjTach"/>
            <mapping class="db.entites.Activites"/>
            <mapping class="db.entites.ReFavoris"/>
            <mapping class="db.entites.Domaine"/>
            <mapping class="db.entites.Client"/>
            <mapping class="db.entites.Qualites"/>
            <mapping class="db.entites.ReGroupeTravail"/>
        </session-factory>
    </hibernate-configuration>
    Pour supprimer un enregistrement (par exemple un objet Projet) j’utilise la méthode suivante
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    public boolean deleteProjet(Projets projet) throws Exception {
            boolean ok = false;
            Session session = HibernateUtil.getSessionFactory().getCurrentSession();
            Transaction transaction = session.beginTransaction();
            session.delete(projet);
            transaction.commit();
            ok = true;
            return ok;
        }
    Bien évidemment s’il existait une contrainte pour la suppression de cet objet j’aurais l’exception org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update

    En mode développement sous NetBeans, je n’ai pas de souci mais lorsque je déploie mon .war sur un serveur Tomcat et en essayant de provoquer l’erreur, le temps de réponse devient énorme (presque 10 à 15 min) comme si l’application tournait à vide ou avait planté.

    Remarque: le serveur Tomcat de production est sur le même réseau que la base et le Tomcat de développement n’est pas sur le même réseau.

    J’utilise la même version de Tomcat en mode dév et prod et aussi pour Java.
    Tomcat : apache-tomcat-6.0.26
    Java : jdk1.6.0_24

    Quelqu'un aurait-il une idée sur l'origine du problème ?
    Si vous avez besoin de plus d’information n’hésiter pas.

    Merci d'avance pour votre aide.

  2. #2
    Membre Expert
    Homme Profil pro
    Directeur technique
    Inscrit en
    Janvier 2007
    Messages
    1 348
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Directeur technique

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 348
    Par défaut
    Pour analyser là, je pense que le mieux serait de regarder les logs. Tu as accès à ceux de prod ? Tu utilises quel framework de log ? Tu as moyen de les mettre en debug pour hibernate et jdbc ?

  3. #3
    Membre averti
    Inscrit en
    Décembre 2010
    Messages
    39
    Détails du profil
    Informations forums :
    Inscription : Décembre 2010
    Messages : 39
    Par défaut
    Bonjour,
    l'instruction qui bloque est :
    voici le log de l'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
    18/12/2012 13:46:09   WARN JDBCExceptionReporter:77 - SQL Error: 2292, SQLState: 23000
    18/12/2012 13:46:09  ERROR JDBCExceptionReporter:78 - ORA-02292: violation de contrainte (RHUSER.RE_FAVORIS_R01) d'intégrité - enregistrement fils existant
    
    18/12/2012 13:50:02   WARN JDBCExceptionReporter:77 - SQL Error: 2292, SQLState: 23000
    18/12/2012 13:50:02  ERROR JDBCExceptionReporter:78 - ORA-02292: violation de contrainte (RHUSER.RE_FAVORIS_R01) d'intégrité - enregistrement fils existant
    
    18/12/2012 13:53:58  ERROR AbstractFlushingEventListener:301 - Could not synchronize database state with session
    org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
    	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
    	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
    	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
    	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
    	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:143)
    	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
    	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
    	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
    	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
    	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
    	at db.services.DataTransaction.deleteProjet(DataTransaction.java:364)
    	at com.gz.composant.admin.supp.SupprimerProjet$1.buttonClick(SupprimerProjet.java:48)
    	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:597)
    	at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:512)
    	at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
    	at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1219)
    	at com.vaadin.ui.Button.fireClick(Button.java:550)
    	at com.vaadin.ui.Button.changeVariables(Button.java:217)
    	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.changeVariables(AbstractCommunicationManager.java:1451)
    	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1399)
    	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1318)
    	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:763)
    	at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:296)
    	at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    	at com.googlecode.psiprobe.Tomcat60AgentValve.invoke(Tomcat60AgentValve.java:30)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    	at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
    	at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
    	at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
    	at java.lang.Thread.run(Thread.java:662)
    Caused by: java.sql.BatchUpdateException: ORA-02292: violation de contrainte (RHUSER.RE_FAVORIS_R01) d'intégrité - enregistrement fils existant
    
    	at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
    	at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10698)
    	at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
    	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
    	... 38 more
    18/12/2012 13:57:56   INFO SupprimerProjet:53 - >>>>>>>>>>>>> ConstraintViolationException 1
    à chaque fois il y a presque 4 min en tous 12 min pour l'exception, c'est le temps de blocage.
    quelqu'un à une idée de la cause?
    merci pour votre aide.

  4. #4
    Membre averti
    Inscrit en
    Décembre 2010
    Messages
    39
    Détails du profil
    Informations forums :
    Inscription : Décembre 2010
    Messages : 39
    Par défaut
    une remarque:
    en mode de dev c'est la même erreur (ce qui est normal)
    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
    18/12/2012 14:16:23  WARN JDBCExceptionReporter:77 - SQL Error: 2292, SQLState: 23000
    18/12/2012 14:16:23 ERROR JDBCExceptionReporter:78 - ORA-02292: violation de contrainte (RHUSER.RE_FAVORIS_R01) d'intégrité - enregistrement fils existant
    
    18/12/2012 14:16:26  WARN JDBCExceptionReporter:77 - SQL Error: 2292, SQLState: 23000
    18/12/2012 14:16:26 ERROR JDBCExceptionReporter:78 - ORA-02292: violation de contrainte (RHUSER.RE_FAVORIS_R01) d'intégrité - enregistrement fils existant
    
    18/12/2012 14:16:29 ERROR AbstractFlushingEventListener:301 - Could not synchronize database state with session
    org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
    	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
    	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
    	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
    	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
    	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:143)
    	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
    	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
    	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
    	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
    	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
    	at db.services.DataTransaction.deleteProjet(DataTransaction.java:364)
    	at com.gz.composant.admin.supp.SupprimerProjet$1.buttonClick(SupprimerProjet.java:48)
    	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:597)
    	at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:512)
    	at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
    	at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1219)
    	at com.vaadin.ui.Button.fireClick(Button.java:550)
    	at com.vaadin.ui.Button.changeVariables(Button.java:217)
    	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.changeVariables(AbstractCommunicationManager.java:1451)
    	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1399)
    	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1318)
    	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:763)
    	at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:296)
    	at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    	at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
    	at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
    	at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
    	at java.lang.Thread.run(Thread.java:662)
    Caused by: java.sql.BatchUpdateException: ORA-02292: violation de contrainte (RHUSER.RE_FAVORIS_R01) d'intégrité - enregistrement fils existant
    
    	at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
    	at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10698)
    	at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
    	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
    	... 37 more
    18/12/2012 14:16:31  INFO SupprimerProjet:53 - >>>>>>>>>>>>> ConstraintViolationException 1
    ici l'exception dure quelques secondes seulement.

  5. #5
    Membre Expert
    Homme Profil pro
    Directeur technique
    Inscrit en
    Janvier 2007
    Messages
    1 348
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Directeur technique

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 348
    Par défaut
    Tu as essayé de te connecter à la base de prod avec un client oracle et de passer le SQL à la main pour voir si tu as aussi un délai sur l'erreur ?

  6. #6
    Membre averti
    Inscrit en
    Décembre 2010
    Messages
    39
    Détails du profil
    Informations forums :
    Inscription : Décembre 2010
    Messages : 39
    Par défaut
    Oui, je me connecte sur la base prod avec un client Oracle (depuis mon poste) et le temps de réponse est immédiat.

    En fait, je ne change pas la base, c'est toujours la même (mode dev et prod). Ce qui change c'est le serveur Tomcat pour le déploiement même si c'est la même version de Tomcat et JDK que pour la prod et le dev.

    Sur le serveur de prod je n'ai pas de client Oracle, je ne peux pas faire ce test mais vous m'avez donné une idée, je vais créer une application de test avec laquelle la connexion est gérée par Tomcat (context.xml) et je vais utiliser l'interface de prod (Data Source) pour exécuter le SQL.

  7. #7
    Membre averti
    Inscrit en
    Décembre 2010
    Messages
    39
    Détails du profil
    Informations forums :
    Inscription : Décembre 2010
    Messages : 39
    Par défaut
    J'ai fais le test et le temps de réponse est instantané.

    Je suis bloqué et je ne vois pas pourquoi lorsqu'il s'agit d'une violation de contrainte, l’instruction transaction.commit(); génère l'exception ConstraintViolationException. Cette exception dure plusieurs minutes.

    Une autre remarque : Lorsque la commande ne génère pas d'exception, le temps de réponse est instantané.

    Une idée ?

  8. #8
    Membre Expert
    Homme Profil pro
    Directeur technique
    Inscrit en
    Janvier 2007
    Messages
    1 348
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Directeur technique

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 348
    Par défaut
    Pas vraiment d'idée non désolé Juste que si j'avais à analyser ça, je passerais comme je t'avais dit hibernate et jdbc en mode debug, pour avoir plus d'infos et pouvoir identifier exactement où il bloque.

  9. #9
    Membre averti
    Inscrit en
    Décembre 2010
    Messages
    39
    Détails du profil
    Informations forums :
    Inscription : Décembre 2010
    Messages : 39
    Par défaut
    je passerais comme je t'avais dit hibernate et jdbc en mode debug
    Comment passer en mode debug ?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <property name="hibernate.show_sql">true</property>
    Est ce que c’est ça ?
    Si oui alors le résultat est :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Hibernate: delete from PROJET_CLIENT where ID_PROJ=?
    Puis l’erreur si dessous.
    Je ne sais pas vraiment ce qui ce passe, j’ai déployé mon .war sur trois autres serveurs tomcat, j’ai eu ce problème sur deux serveurs et sur le troisième le résultat est bon repense instantané.
    Le souci est que je ne sais pas si le problème vient de mon code ou ma configuration d’Hibernate ou du serveur tomcat.

  10. #10
    Membre Expert
    Homme Profil pro
    Directeur technique
    Inscrit en
    Janvier 2007
    Messages
    1 348
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Directeur technique

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 348
    Par défaut
    Non, ce n'est pas ça que je voulais dire.
    Tu nous a mis une copie de ton fichier de log.
    Dans ton système de log (potentiellement log4j mais pas sûr), il y a des niveaux de détails.
    Dans tes extraits, tu as des logs INFO, WARNING et ERROR. En revanche, ton système de log est réglé pour ne pas afficher le niveau DEBUG. En changeant ça, tu vas avoir des tonnes d'information en plus (DEBUG c'est vraiment verbeux) mais on devrait pouvoir analyser mieux ce qui se produit.

  11. #11
    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
    Tu devrais faire un rollback de ta transaction en cas d'exception.

  12. #12
    Membre averti
    Inscrit en
    Décembre 2010
    Messages
    39
    Détails du profil
    Informations forums :
    Inscription : Décembre 2010
    Messages : 39
    Par défaut
    Ah, je comprends ce que tu veux dire.
    Oui effectivement c’est le log4j que j’utilise.
    J’ai mis des instructions de log dans mon code en espérant que ça peut m’aider à déterminer le problème.
    Voici le code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
        public boolean deleteProjet(Projets projet) throws Exception {
            boolean ok = false;
            log4j.info(">>>>>>>>>>>>> 1");
            Session session = HibernateUtil.getSessionFactory().getCurrentSession();
            Transaction transaction = session.beginTransaction();
            log4j.info(">>>>>>>>>>>>> 2");
            session.delete(projet);
            log4j.info(">>>>>>>>>>>>> 3");
            transaction.commit();
            log4j.info(">>>>>>>>>>>>> 4");
            ok = true;
            return ok;
        }
    Voici le log en mode Debug :
    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
    119
    120
    121
    122
    123
    124
    125
    19/12/2012 17:13:11   INFO DataTransaction:358 - >>>>>>>>>>>>> 1
    19/12/2012 17:13:11  DEBUG SessionImpl:220 - opened session at timestamp: 13559335916
    19/12/2012 17:13:11  DEBUG JDBCTransaction:54 - begin
    19/12/2012 17:13:11  DEBUG ConnectionManager:421 - opening JDBC connection
    19/12/2012 17:13:11  DEBUG JDBCTransaction:59 - current autocommit status: false
    19/12/2012 17:13:11   INFO DataTransaction:361 - >>>>>>>>>>>>> 2
    19/12/2012 17:13:11   INFO DataTransaction:363 - >>>>>>>>>>>>> 3
    19/12/2012 17:13:11  DEBUG JDBCTransaction:103 - commit
    19/12/2012 17:13:11  DEBUG AbstractFlushingEventListener:111 - processing flush-time cascades
    19/12/2012 17:13:11  DEBUG AbstractFlushingEventListener:154 - dirty checking collections
    19/12/2012 17:13:11  DEBUG Collections:52 - Collection dereferenced: [db.entites.Projets.clients#183]
    19/12/2012 17:13:11  DEBUG Collections:52 - Collection dereferenced: [db.entites.Projets.empProjTachs#183]
    19/12/2012 17:13:11  DEBUG Collections:52 - Collection dereferenced: [db.entites.Projets.reFavorises#183]
    19/12/2012 17:13:11  DEBUG AbstractFlushingEventListener:85 - Flushed: 0 insertions, 0 updates, 1 deletions to 1 objects
    19/12/2012 17:13:11  DEBUG AbstractFlushingEventListener:91 - Flushed: 0 (re)creations, 0 updates, 3 removals to 3 collections
    19/12/2012 17:13:11  DEBUG Printer:83 - listing entities:
    19/12/2012 17:13:11  DEBUG Printer:90 - db.entites.Projets{empProjTachs=<uninitialized>, qualites=db.entites.Qualites#1, reFavorises=<uninitialized>, domaine=db.entites.Domaine#82, idProj=183, libProj=*2010DI - ASP Fashion, clients=<uninitialized>}
    19/12/2012 17:13:11  DEBUG AbstractCollectionPersister:1010 - Deleting collection: [db.entites.Projets.clients#183]
    19/12/2012 17:13:11  DEBUG AbstractBatcher:366 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
    19/12/2012 17:13:11  DEBUG SQL:401 - delete from PROJET_CLIENT where ID_PROJ=?
    19/12/2012 17:13:11  DEBUG AbstractCollectionPersister:1067 - done deleting collection
    19/12/2012 17:13:11  DEBUG AbstractBatcher:44 - Executing batch size: 1
    19/12/2012 17:13:11  DEBUG AbstractBatcher:374 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
    19/12/2012 17:13:11  DEBUG JDBCExceptionReporter:69 - Could not execute JDBC batch update [delete from PROJET_CLIENT where ID_PROJ=?]
    java.sql.BatchUpdateException: ORA-02292: violation de contrainte (RHUSER.RE_FAVORIS_R01) d'intégrité - enregistrement fils existant
     
    	at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
    	at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10698)
    	at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
    	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
    	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
    	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:143)
    	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
    	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
    	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
    	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
    	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
    	at db.services.DataTransaction.deleteProjet(DataTransaction.java:364)
    	at com.gz.composant.admin.supp.SupprimerProjet$1.buttonClick(SupprimerProjet.java:48)
    	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:597)
    	at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:512)
    	at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
    	at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1219)
    	at com.vaadin.ui.Button.fireClick(Button.java:550)
    	at com.vaadin.ui.Button.changeVariables(Button.java:217)
    	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.changeVariables(AbstractCommunicationManager.java:1451)
    	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1399)
    	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1318)
    	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:763)
    	at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:296)
    	at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    	at com.googlecode.psiprobe.Tomcat60AgentValve.invoke(Tomcat60AgentValve.java:30)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    	at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
    	at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
    	at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
    	at java.lang.Thread.run(Thread.java:662)
    19/12/2012 17:13:11   WARN JDBCExceptionReporter:77 - SQL Error: 2292, SQLState: 23000
    19/12/2012 17:13:11  ERROR JDBCExceptionReporter:78 - ORA-02292: violation de contrainte (RHUSER.RE_FAVORIS_R01) d'intégrité - enregistrement fils existant
     
    19/12/2012 17:17:18   WARN JDBCExceptionReporter:77 - SQL Error: 2292, SQLState: 23000
    19/12/2012 17:17:18  ERROR JDBCExceptionReporter:78 - ORA-02292: violation de contrainte (RHUSER.RE_FAVORIS_R01) d'intégrité - enregistrement fils existant
     
    19/12/2012 17:21:12  ERROR AbstractFlushingEventListener:301 - Could not synchronize database state with session
    org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
    	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
    	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
    	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
    	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
    	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:143)
    	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
    	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
    	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
    	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
    	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
    	at db.services.DataTransaction.deleteProjet(DataTransaction.java:364)
    	at com.gz.composant.admin.supp.SupprimerProjet$1.buttonClick(SupprimerProjet.java:48)
    	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:597)
    	at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:512)
    	at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
    	at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1219)
    	at com.vaadin.ui.Button.fireClick(Button.java:550)
    	at com.vaadin.ui.Button.changeVariables(Button.java:217)
    	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.changeVariables(AbstractCommunicationManager.java:1451)
    	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1399)
    	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1318)
    	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:763)
    	at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:296)
    	at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    	at com.googlecode.psiprobe.Tomcat60AgentValve.invoke(Tomcat60AgentValve.java:30)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    	at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
    	at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
    	at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
    	at java.lang.Thread.run(Thread.java:662)
    Caused by: java.sql.BatchUpdateException: ORA-02292: violation de contrainte (RHUSER.RE_FAVORIS_R01) d'intégrité - enregistrement fils existant
     
    	at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
    	at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10698)
    	at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
    	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
    	... 38 more
    19/12/2012 17:25:10   INFO SupprimerProjet:53 - >>>>>>>>>>>>> ConstraintViolationException 1
    Merci pour votre aide.

  13. #13
    Membre averti
    Inscrit en
    Décembre 2010
    Messages
    39
    Détails du profil
    Informations forums :
    Inscription : Décembre 2010
    Messages : 39
    Par défaut
    Citation Envoyé par fr1man Voir le message
    Tu devrais faire un rollback de ta transaction en cas d'exception.
    Il faut le faire le rollback à quel niveau ?
    L’exception se déclenche au niveau de transaction.commit() .
    Et le blocage est au niveau de l’exception, c’est le temps de retours d’exception qui dure presque 12 minutes.
    Si j’obtiens mon exception mon problème est résolut et je peux terminer mon traitement.

  14. #14
    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
    Que ce soit ça ou pas qui bloque, il faut faire un rollback de ta transaction en cas de problème, sinon, elle sera seulement annulée par un timeout.
    Il faudrait gérer comme cela (en gros)
    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
     
     public boolean deleteProjet(Projets projet) throws Exception {
            boolean ok = false;
            log4j.info(">>>>>>>>>>>>> 1");
            Session session = HibernateUtil.getSessionFactory().getCurrentSession();
            Transaction transaction = session.beginTransaction();
            log4j.info(">>>>>>>>>>>>> 2");
            try {
              session.delete(projet);
              log4j.info(">>>>>>>>>>>>> 3");
              transaction.commit();
            }
            catch(Exception e) //affiner l'exception si besoin
            {
              transaction.rollback();
              throw e;
            }
            log4j.info(">>>>>>>>>>>>> 4");
            ok = true;
            return ok;
        }

  15. #15
    Membre Expert
    Homme Profil pro
    Directeur technique
    Inscrit en
    Janvier 2007
    Messages
    1 348
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Directeur technique

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 348
    Par défaut
    Tout à fait d'accord avec fr1man, il faut gérer l'exception. Accessoirement, je ne comprends pas trop pourquoi ta méthode retourne un booléen, puisque s'il y a un problème c'est géré par exception, donc tu peux retourner void.

    Mais cela ne résout pas le souci de blocage que tu as à mon avis. C'est étrange là dans ton log, il ne fait rien on dirait quand il bloque.
    Deux possibilités :
    - Tu n'es pas en full DEBUG (là hibernate est bien en debug, mais est-ce que tu as mis seulement sur hibernate ou sur tout ?) -> mettre en full DEBUG pour avoir de l'info
    - Provoquer un thread dump pendant le blocage pour savoir sur quoi il bloque (regarde sur le net comment faire. si tu ne trouves pas, dis nous sur quel os tourne ton tomcat)

  16. #16
    Membre averti
    Inscrit en
    Décembre 2010
    Messages
    39
    Détails du profil
    Informations forums :
    Inscription : Décembre 2010
    Messages : 39
    Par défaut
    Bonjour,
    Merci beaucoup pour les pistes que vous m'avez données.
    Je viens de découvrir mon problème (en lisant bien le log sur mon tomcat).
    J’explique :
    J’utilise le log4j pour loguer
    log4j.rootLogger= debug ,stdout , Daily , mail
    Donc le problème est dans le log mail, il fait un time out (presque 4 min) avant de rendre la main au programme.
    J’avoue que c’est une bêtise de ma part, je ne regarde que le fichier du log Daily .
    Du coup c'est un faut problème hibernate ou tomcat.
    Désolé encore pour ce faut problème.
    Cordialement,

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

Discussions similaires

  1. Spyware qui bloque le fond d'écran Windows
    Par akli_agha dans le forum Sécurité
    Réponses: 6
    Dernier message: 02/02/2006, 17h16
  2. pc qui bloque et message du BIOS
    Par ouldfella dans le forum Ordinateurs
    Réponses: 4
    Dernier message: 13/10/2005, 14h22
  3. Réponses: 3
    Dernier message: 22/07/2005, 15h16
  4. [MFC] fonction ReadFile qui bloque
    Par r0d dans le forum MFC
    Réponses: 9
    Dernier message: 15/04/2005, 13h21
  5. Réponses: 6
    Dernier message: 21/03/2005, 13h22

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