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 :

Erreur 500 [Débutant(e)]


Sujet :

Servlets/JSP Java

  1. #1
    Nouveau Candidat au Club
    Homme Profil pro
    Analyste d'exploitation
    Inscrit en
    Mars 2012
    Messages
    2
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Analyste d'exploitation
    Secteur : Transports

    Informations forums :
    Inscription : Mars 2012
    Messages : 2
    Points : 1
    Points
    1
    Par défaut Erreur 500
    Bsr

    Je début en developpement java.
    Je but sur un msg d'erreur:

    Etat HTTP 500 - type Rapport d''exception

    message: description Le serveur a rencontré une erreur interne () qui l'a empêché de satisfaire la requête.

    exception
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    org.apache.jasper.JasperException: java.lang.NullPointerException
    	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
    	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
    	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	servlet.authentification.doGet(authentification.java:22)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    cause mère
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    java.lang.NullPointerException
    	org.apache.jsp.authentification_jsp._jspService(authentification_jsp.java:69)
    	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	servlet.authentification.doGet(authentification.java:22)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    note La trace complète de la cause mère de cette erreur est disponible dans les fichiers journaux de Apache Tomcat/7.0.26.

  2. #2
    Nouveau Candidat au Club
    Homme Profil pro
    Analyste d'exploitation
    Inscrit en
    Mars 2012
    Messages
    2
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Analyste d'exploitation
    Secteur : Transports

    Informations forums :
    Inscription : Mars 2012
    Messages : 2
    Points : 1
    Points
    1
    Par défaut voici mon code
    Le message d'erreur plus haut s'affiche quand je lance:
    lovalhost:8080/TP2/acceuil

    Pour ma servlet: authentification.java
    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
    package servlet;
     
     
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
     
    public class authentification extends HttpServlet {
     
    	private static final long serialVersionUID = 11L;
     
    	public void doGet(	HttpServletRequest request, 
    				HttpServletResponse response)
    				throws IOException, ServletException{
     
    		request.getRequestDispatcher("authentification.jsp").forward(request, response);		
    	}
     
    	public void doPost(	HttpServletRequest request, 
    			HttpServletResponse response)
    			throws IOException, ServletException{
     
    		doGet(request, response);		
    	}
     
    }
    Pour mon authentification.jsp
    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
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
     
    <%String nom1=request.getParameter("nom").toUpperCase(); %>
    <%@ include file="entete.jsp" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    	<head>
    		<title>L'e-421</title>
    		<meta http-equiv="Content-Type" content="text/htm" charset="UTF-8">
    	</head>
    <body>
    	<div style="width:100%; text-align:center;">
    		<table style="width: 250px; height: 93px; font-weight: bold; text-align: left; margin-left: auto; margin-right: auto;" border="0" cellpadding="2" cellspacing="2">
    			<tbody>
    				<tr><td style="background-color: yellow; text-align: center;"><H1>L'e-421</H1></td></tr>
    			</tbody>
    		</table>
    		<br><hr style="width: 20%; height: 2px;"><br>
    		<table style="background-color: rgb(0, 153, 0); width: 250px; height: 93px; font-weight: bold; text-align: left; margin-left: auto; margin-right: auto;" border="0" cellpadding="0" cellspacing="5">
    			<tr>
    				<form name="authentification" action="acceuil" method="post"></tr>
    					<tr><td >Nom :</td>  <td ><input name="nom" value="Votre nom" type="text"></td> </tr>
    					<tr>  <td ><input type="submit" value="Valider">
    				</form></td > 	
    			</tr>
    		</table>
    	</div>
    	<h2> Bienvenue <% out.println(nom1); %></h2>
    	<h4>Pour revenir a l'acceuil c'est <a href="acceuil"> par ici</a></h4>
     
     
    </body>
    </html>
    et enfin mon web.xml
    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
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
        <servlet>
            <servlet-name>authentification</servlet-name>
            <servlet-class>servlet.authentification</servlet-class>
            <init-param>
                <param-name>message</param-name>
                <param-value>Bienvenue sur cet espace</param-value>
            </init-param>
        </servlet>
        <servlet-mapping>
            <servlet-name>authentification</servlet-name>
            <url-pattern>/acceuil</url-pattern>
        </servlet-mapping>
    <error-page>
       <error-code>404</error-code>
       <location>/404.jsp</location>
    </error-page>
     
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
    </web-app>
    Fichiers attachés Fichiers attachés

  3. #3
    Membre habitué
    Profil pro
    Inscrit en
    Juillet 2010
    Messages
    141
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2010
    Messages : 141
    Points : 178
    Points
    178
    Par défaut
    Oui mais si tu lui demandes de récupérer un paramètre que ta définit nulle part c'est normal qu'il refuse.

  4. #4
    Membre chevronné
    Avatar de fxrobin
    Homme Profil pro
    Architecte SI, Java Fan, API Manager
    Inscrit en
    Novembre 2007
    Messages
    875
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Architecte SI, Java Fan, API Manager
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Novembre 2007
    Messages : 875
    Points : 2 112
    Points
    2 112
    Par défaut
    Effectivement, le problème vient de là.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <%String nom1=request.getParameter("nom").toUpperCase(); %>
    quand tu accèdes à ton URL d'accueil, ça forwarde directement sur ta page qui essaye de récupérer la variable HTML "nom" depuis un formulaire qui n'a pas été saisi ... donc NULL ... et enfin le toUpperCase sur une variable "NULL" ça n'a jamais bien marché en JAVA

Discussions similaires

  1. Erreur 500
    Par Neuromancien2 dans le forum Langage
    Réponses: 3
    Dernier message: 11/10/2005, 23h41
  2. XMLC_ReleaseXMLApplication : Erreur 500 ?
    Par Sylvain James dans le forum XMLRAD
    Réponses: 1
    Dernier message: 09/05/2005, 23h35
  3. [tomcat] Erreur 500 à l'appel de la servlet
    Par Kyti dans le forum Tomcat et TomEE
    Réponses: 26
    Dernier message: 06/04/2005, 09h37
  4. [web] [CGI][Easyphp] erreur 500
    Par nico72 dans le forum Web
    Réponses: 11
    Dernier message: 29/07/2004, 20h08
  5. Réponses: 6
    Dernier message: 28/10/2002, 11h34

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