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

JDBC Java Discussion :

JDBC: Result set already closed


Sujet :

JDBC Java

  1. #1
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    3
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 3
    Points : 1
    Points
    1
    Par défaut JDBC: Result set already closed
    Bonjour à tous,
    j'essaie d'éxécuter une requête en utilisant une connection JDBC et j'obtient l'exception suivante:

    java.sql.SQLException: Result set already closed

    et pourtant je ferme les connection, statement et resultset dans le bloc finally.

    pour info j'utilise weblogic 8.1.

    Merci de votre aide.

    Kid

  2. #2
    Rédacteur
    Avatar de lunatix
    Homme Profil pro
    Architecte technique
    Inscrit en
    Novembre 2002
    Messages
    1 960
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Architecte technique

    Informations forums :
    Inscription : Novembre 2002
    Messages : 1 960
    Points : 3 736
    Points
    3 736
    Par défaut
    salut... peut etre pourrais tu montrer un peu de code, parce que la, sans rien, on ne peut pas t'aider

  3. #3
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    3
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 3
    Points : 1
    Points
    1
    Par défaut
    ok, voici mon code

    private void batch() throws SavAgenceException, Exception {
    try {
    connection = getSavAgence().getConnection(POOL_NAME);
    statement = connection.createStatement();
    resultSet = statement.executeQuery("select * from AV_EXTRAC_EVT");
    int i = 0;
    while (resultSet.next()) {
    i++;
    }
    } catch (Exception exc) {
    exc.printStackTrace();

    }finally{
    try {
    if (resultSet != null) {
    resultSet.close();
    }
    }catch (Exception e) {}

    try {
    if (statement != null) {
    statement.close();
    }
    }catch (Exception e) {}

    try {
    if (connection != null) {
    connection.close();
    }
    }catch (Exception e) {}

    }
    }

    voici les traces d'exceptions:

    <27 avr. 2006 15 h 21 CEST> <Warning> <JDBC> <BEA-001074> <A JDBC pool connection leak was detected. A connection leak occurs when a connection obtained from the pool was not closed explicitly by calling close() and then was disposed by the garbage collector and returned to the connection pool. The following stack trace at create shows where the leaked connection was created. [Null exception passed, creating stack trace for offending caller]

    at weblogic.utils.StackTraceUtils.throwable2StackTrace(StackTraceUtils.java:28)

    at weblogic.jdbc.rmi.SerialConnection.finalize(SerialConnection.java:86)

    at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)

    at java.lang.ref.Finalizer.runFinalizer(Unknown Source)

    at java.lang.ref.Finalizer.access$100(Unknown Source)

    at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)

    >

    java.sql.SQLException: Result set already closed

    at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)

    at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:137)

    at weblogic.jdbc.rmi.internal.ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_com_p6spy_engine_logging_P6LogResultSet_811_WLStub.next(Unknown Source)

    at weblogic.jdbc.rmi.internal.ResultSetStub_weblogic_jdbc_rmi_internal_ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_com_p6spy_engine_logging_P6LogResultSet_811_WLStub.next(Unknown Source)

    at weblogic.jdbc.rmi.internal.ResultSetStraightReader.next(ResultSetStraightReader.java:27)

    at weblogic.jdbc.rmi.SerialResultSet.next(SerialResultSet.java:84)

    at fr.chronopost.batch.suivi.AlimenteurSherlock.batch(AlimenteurSherlock.java:174)

    at fr.chronopost.batch.suivi.AlimenteurSherlock.<init>(AlimenteurSherlock.java:113)

    at fr.chronopost.batch.suivi.AlimenteurSherlock.main(AlimenteurSherlock.java:131)

    Caused by: java.sql.SQLException: Result set already closed

    at weblogic.jdbc.wrapper.ResultSet.checkResultSet(ResultSet.java:90)

    at weblogic.jdbc.wrapper.ResultSet.preInvocationHandler(ResultSet.java:53)

    at weblogic.jdbc.wrapper.ResultSet_com_p6spy_engine_logging_P6LogResultSet.next(Unknown Source)

    at weblogic.jdbc.rmi.internal.ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_com_p6spy_engine_logging_P6LogResultSet.next(Unknown Source)

    at weblogic.jdbc.rmi.internal.ResultSetImpl_weblogic_jdbc_wrapper_ResultSet_com_p6spy_engine_logging_P6LogResultSet_WLSkel.invoke(Unknown Source)

    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:466)

    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:409)

    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:353)

    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)

    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:404)

    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)

    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)

    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

    java.rmi.NoSuchObjectException: The object identified by: '341' could not be found. Either it was has not been exported or it has been collected by the distributed garbage collector.

    at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)

    at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:137)

    at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_com_p6spy_engine_logging_P6LogConnection_811_WLStub.rollback(Unknown Source)

    at weblogic.jdbc.rmi.SerialConnection_weblogic_jdbc_rmi_internal_ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_com_p6spy_engine_logging_P6LogConnection_811_WLStub.rollback(Unknown Source)

    at fr.chronopost.batch.suivi.AlimenteurSherlock.batch(AlimenteurSherlock.java:233)

    at fr.chronopost.batch.suivi.AlimenteurSherlock.<init>(AlimenteurSherlock.java:113)

    at fr.chronopost.batch.suivi.AlimenteurSherlock.main(AlimenteurSherlock.java:131)

    --------------- nested within: ------------------

    weblogic.rmi.extensions.RemoteRuntimeException: Unexpected Exception - with nested exception:

    [java.rmi.NoSuchObjectException: The object identified by: '341' could not be found. Either it was has not been exported or it has been collected by the distributed garbage collector.]

    at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_com_p6spy_engine_logging_P6LogConnection_811_WLStub.rollback(Unknown Source) KID >> FIN

    at weblogic.jdbc.rmi.SerialConnection_weblogic_jdbc_rmi_internal_ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_com_p6spy_engine_logging_P6LogConnection_811_WLStub.rollback(Unknown Source)

    at fr.chronopost.batch.suivi.AlimenteurSherlock.batch(AlimenteurSherlock.java:233)

    at fr.chronopost.batch.suivi.AlimenteurSherlock.<init>(AlimenteurSherlock.java:113)

    at fr.chronopost.batch.suivi.AlimenteurSherlock.main(AlimenteurSherlock.java:131)

    Merci pour votre aide.

  4. #4
    Membre averti
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    746
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 746
    Points : 316
    Points
    316
    Par défaut
    voici mon humble avis :

    Ca plante ici :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    connection = getSavAgence().getConnection(POOL_NAME);
    il arrive pas à avoir la connection, une exception est lancée, ensuite je sais pas pourquoi il doit essayer de fermer le resultSet je sais pas comment parce qu'il ne devrait pas rentrer dans if (resultSet!=null) mais bon...

    parce que already closed ca veut bien dire qu'il est déjà fermé et que tu essaye de le fermer à nouveau...

  5. #5
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    3
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 3
    Points : 1
    Points
    1
    Par défaut
    le Warning suirvient à ce moment:
    resultSet = statement.executeQuery("select * from AV_EXTRAC_EVT");

    et l'exception est lancée quand je fais:
    while (resultSet.next()){
    ...
    }

    j'ai l'impression qu'une autre connection (fantôme...) est présente, du coup je pense que c'est pour ça qu'il dit qu'il y a une autre connection leak.

    Mais tout avis m'intéresse car là je suis complétement bloqué.

  6. #6
    Membre averti
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    746
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 746
    Points : 316
    Points
    316
    Par défaut
    ca se pourrait pas que le pool soit configuré pour ne donner que n connexions, et que ce nombre soit déjà atteint ou un truc du genre?

Discussions similaires

  1. result set is closed
    Par doc dans le forum Connexion aux bases de données
    Réponses: 2
    Dernier message: 12/09/2008, 13h44
  2. The result set is closed
    Par breezer911 dans le forum JDBC
    Réponses: 4
    Dernier message: 20/03/2008, 09h58
  3. [JDBC]Result set d'une procédure stockée
    Par Vikisme dans le forum SQL Procédural
    Réponses: 3
    Dernier message: 26/04/2007, 16h53
  4. Réponses: 3
    Dernier message: 24/11/2005, 12h24
  5. Unable to save result set
    Par souf dans le forum Requêtes
    Réponses: 3
    Dernier message: 19/07/2004, 15h41

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