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

Servlets/JSP Java Discussion :

java.lang.InstantiationException : java.sql.ResultSet


Sujet :

Servlets/JSP Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2007
    Messages
    167
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 167
    Par défaut java.lang.InstantiationException : java.sql.ResultSet
    A la fin d'une Servlet, lorsque je lance la requête d'affichage d'une page JSP j'ai cette exception qui est soulevée :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    javax.servlet.ServletException: interface java.sql.ResultSet : java.lang.InstantiationException: java.sql.ResultSet
    Si quelqu'un a déjà eu ce problème et peut m'en dire plus ?!!!!

  2. #2
    Expert éminent
    Avatar de adiGuba
    Homme Profil pro
    Développeur Java/Web
    Inscrit en
    Avril 2002
    Messages
    13 938
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Java/Web
    Secteur : Transports

    Informations forums :
    Inscription : Avril 2002
    Messages : 13 938
    Billets dans le blog
    1
    Par défaut
    Salut,


    Ce type d'erreur survient en cas de problème lors de l'instanciation d'un nouvel objet... Or il s'agit ici d'une interface...


    Quel est le code concerné et le stacktrace complet de l'exception ?

    a++

  3. #3
    Membre confirmé
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2007
    Messages
    167
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 167
    Par défaut
    Cela survient sur l'instruction suivante :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    	try {
    	    getServletContext ().getRequestDispatcher ( page ).forward ( q , r ) ;
    	}
    	catch ( Exception e ) {
    	    e.printStackTrace () ;
    	    System.out.println ( "Erreur lors de la présentation de la page de modification d'intervenant" ) ;
    	    return ;
    	}

    Le code de la JSP qui tente de s'afficher est le suivant :

    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
    <%@ page import="java.sql.ResultSet" %>
     
    <jsp:useBean id="idtacheAmodif"  scope="session" class="java.lang.String"/>
    <jsp:useBean id="categorie"  scope="session" class="java.lang.String"/>
    <jsp:useBean id="type"  scope="session" class="java.lang.String"/>
    <jsp:useBean id="priorite"  scope="session" class="java.lang.String"/>
    <jsp:useBean id="statut"  scope="session" class="java.lang.String"/>
    <jsp:useBean id="nomDem"  scope="session" class="java.lang.String"/>
    <jsp:useBean id="prenomDem"  scope="session" class="java.lang.String"/>
    <jsp:useBean id="telDem"  scope="session" class="java.lang.String"/>
    <jsp:useBean id="serviceDem"  scope="session" class="java.lang.String"/>
    <jsp:useBean id="titre"  scope="session" class="java.lang.String"/>
    <jsp:useBean id="description"  scope="session" class="java.lang.String"/>
    <jsp:useBean id="debut"  scope="session" class="java.lang.String"/>
    <jsp:useBean id="listeInter"  scope="session" class="java.sql.ResultSet"/>
     
    <html>
    <head>
    <link href="css/design.css" rel="stylesheet" type="text/css">
    <title>
    traiter une tâche
    </title>
     
    </head>
     
    <body>
    <form action="" method="POST" name="">
    <h1 align="center">Traitement d'une tâche</h1>
    <br><br>
    <table width="100%">
         <tr align="center">
              <td>Titre de la demande : <input size="80%" type="text" name="titre" value="<%=titre%>" disabled="true"></td>
              <td>Date de début : <input type="text" name="datedebut" value="<%=debut%>" disabled="true"></td>
         </tr>
    </table>
    <br><hr width="250px"><br>
    <table width="100%">
         <tr>
              <td colspan="4">Demandeur :</td>
         </tr>
         <tr align="center">
              <td>Nom/Prénom : <input size="15px" type="text" value="<%=nomDem%>" disabled="true" name="nom"> / <input size="15px" type="text" value="<%=prenomDem%>" disabled="true" name="prenom"></td>
              <td>Téléphone : <input size="10px" type="text" value="<%=telDem%>" disabled="true" name="telephone"></td>
              <td>Service : <input size="40px" type="text" value="<%=serviceDem%>" disabled="true" name="service"></td>
         </tr>
    </table>
    <br><hr width="250px"><br>
    <table width="100%">
         <tr align="center">
              <td>Catégorie de la demande : <input type="text" value="<%=categorie%>" disabled="true" name="categorie">
              </td>
              <td>Type de la demande : <input type="text" value="<%=type%>" disabled="true" name="type">
              </td>
              <td>Priorité de la demande : <input type="text" value="<%=priorite%>" disabled="true" name="priorite">
              </td>
         </tr>
    </table>
    <br><hr width="250px"><br>
    <table width="100%">
         <tr>
              <td>Description de la demande :</td>
              <td><textarea cols="100" rows="7" name="description" disabled="true"><%=description%></textarea></td>
         </tr>
     
         <tr>
              <td colspan="2"><br><center>Intervenant de la demande : <select name="intervenant"><%while(listeInter.next())
                                                                            {
                                                                                 %>
                                                                                    <option><%=listeInter.getString("nom")%> <%=listeInter.getString("prenom")%>
                                                                                 <%
                                                                            }%>
                                                                     </select>
              </center></td>
         </tr>
    </table>
    <br><br>
    <center><input type="submit" name="MAJ" value="Mettre à jour la tâche"></center>
    </form>
    <input type="hidden" name="idtacheQuest" value="<%=idtacheAmodif%>">
     
    </form>
    </body>
    </html>

    Et la trace de l'exception :

    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
    javax.servlet.ServletException: interface java.sql.ResultSet : java.lang.InstantiationException: java.sql.ResultSet
     
    	at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:471)
     
    	at org.apache.jsp.changeInter$jsp._jspService(changeInter$jsp.java:547)
     
    	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
     
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     
    	at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
     
    	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)	
     
    	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
     
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:683)
     
    	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:431)
     
    	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:355)
     
    	at Servlets.changeinter.doGet(changeinter.java:78)
     
    	at Servlets.changeinter.doPost(changeinter.java:91)
     
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
     
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
     
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
     
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
     
    	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
     
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
     
    	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
     
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
     
    	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
     
    	at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
     
    	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
     
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
     
    	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
     
    	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
     
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
     
    	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
     
    	at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
     
    	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
     
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
     
    	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
     
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
     
    	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
     
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
     
    	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
     
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
     
    	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
     
    	at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
     
    	at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
     
    	at java.lang.Thread.run(Thread.java:536)

  4. #4
    Expert éminent
    Avatar de adiGuba
    Homme Profil pro
    Développeur Java/Web
    Inscrit en
    Avril 2002
    Messages
    13 938
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Java/Web
    Secteur : Transports

    Informations forums :
    Inscription : Avril 2002
    Messages : 13 938
    Billets dans le blog
    1
    Par défaut
    Salut,

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <jsp:useBean id="listeInter"  scope="session" class="java.sql.ResultSet"/>
    Ceci te crée une nouvelle instance de ResultSet, ce qui est impossible puisque c'est une interface...

    De plus tu devrais faire attention car en passant le ResultSet dans la JSP tu ne ferme pas la connection JDBC...

    a++

  5. #5
    Membre confirmé
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2007
    Messages
    167
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 167
    Par défaut
    J'ai pourtant une autre JSP un peut similaire ou je récupère un ResultSet que j'ai préalablement placé en session et aucune erreur avec celui la .......
    Presque toutes les actions de mon application requiert l'accès à ma BDD donc je l'ai placé en session la connection et je l'utilise jusqu'à expiration de la session ou déconnexion de l'appli.

Discussions similaires

  1. Réponses: 2
    Dernier message: 24/02/2009, 13h24
  2. Exception java.lang.ClassCastException: java.lang.Long save
    Par *alexandre* dans le forum Hibernate
    Réponses: 3
    Dernier message: 07/02/2009, 10h05
  3. Exception: java.lang.RuntimeException: java.lang.NoClassDefFoundError
    Par FrenchFrogger dans le forum Général Java
    Réponses: 1
    Dernier message: 29/01/2009, 17h00
  4. Réponses: 1
    Dernier message: 22/12/2008, 10h12
  5. faultString: java.lang.ArrayStoreException: : java.lang.String
    Par Dev_info dans le forum Services Web
    Réponses: 3
    Dernier message: 21/05/2007, 15h42

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