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 :

File Not Found


Sujet :

Servlets/JSP Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé Avatar de Gregory.M
    Profil pro
    Inscrit en
    Novembre 2007
    Messages
    684
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Novembre 2007
    Messages : 684
    Par défaut File Not Found
    Bonjours,
    Voici mon soucis: dans ma index.jsp j'utilise une classe ("jdom") qui me permet de parcourir un fichier xml. mais le probleme est que lorsque je lance mon projet web, le compilateur va chercher mon fichier .xml dans C:// progfiles/eclipes/... au lieu d'aller le chercher dans mon \workspace\MonProjet\...

    comment puis je faire pour empecher cela?

    j'ai fait des tests pour chercher le probleme, le ligne importante est: document = sxb.build...
    Puis les infos de la console indiquant la ou il va chercher le fichier.

    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
    	   //On crée une instance de SAXBuilder
    	      SAXBuilder sxb = new SAXBuilder();
    	      try
    	      {
    	         //On crée un nouveau document JDOM avec en argument le fichier XML
    	         //Le parsing est terminé ;)
    	         document = sxb.build(new File("games.xml"));
     
     
    	         System.out.println("Doc" + (document == null));
    	      }
    	      catch(Exception e)
    	      {
    	    	  e.printStackTrace();
    	    	  System.out.println(e);
     
    	      }
     
    	      //On initialise un nouvel élément racine avec l'élément racine du document.
    	      racine = document.getRootElement();
       }
    ...
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
    java.io.FileNotFoundException: C:\Program Files\eclipse\games.xml (Le fichier spécifié est introuvable)
    false
    [Element: <games/>]
    []
    voila

  2. #2
    Expert confirmé

    Femme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 5 793
    Par défaut
    Jette un oeil à cette discussion.

  3. #3
    Membre éclairé Avatar de Gregory.M
    Profil pro
    Inscrit en
    Novembre 2007
    Messages
    684
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Novembre 2007
    Messages : 684
    Par défaut :/
    jai essayé ce que tu as dit c_nvy mais ca ne marche toujours pas.
    java.lang.NullPointerException
    at Prog.EPlayGames.Class.JDOM.TheFile(JDOM.java:86)
    at org.apache.jsp.pages.index_jsp._jspService(index_jsp.java:88)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    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:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    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:263)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
    java.lang.NullPointerException
    java.lang.NullPointerException
    at Prog.EPlayGames.Class.JDOM.TheFile(JDOM.java:86)
    at org.apache.jsp.pages.index_jsp._jspService(index_jsp.java:101)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    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:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    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:263)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
    java.lang.NullPointerException
    false
    [Element: <games/>]
    []

  4. #4
    Expert confirmé

    Femme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 5 793
    Par défaut
    Ton fichier games.xml est-il sous WEB-INF/classes ?
    Si ce n'est pas le cas, où est-il exactement ?

  5. #5
    Membre éclairé Avatar de Gregory.M
    Profil pro
    Inscrit en
    Novembre 2007
    Messages
    684
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Novembre 2007
    Messages : 684
    Par défaut
    il se trouve dans Webcontent/WEB-INF
    je n'ai pas de dossier/classes, je dois le créer?

  6. #6
    Expert confirmé

    Femme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 5 793
    Par défaut
    Je suppose donc que le répertoire classes est dans le répertoire build.

    Si ton fichier est sous WEB-INF, essaie ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    document = sxb.build(new File("WEB-INF/games.xml"));

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

Discussions similaires

  1. table externe - file not found
    Par juin29 dans le forum Oracle
    Réponses: 9
    Dernier message: 07/12/2010, 11h52
  2. [Error] File not found: 'Unit1.DFM'
    Par aliwassem dans le forum Delphi
    Réponses: 1
    Dernier message: 08/04/2007, 07h13
  3. File not found
    Par mattyeux dans le forum ASP
    Réponses: 7
    Dernier message: 14/02/2007, 22h12
  4. Exception: TXMLDocument.LoadXMLFile File not found
    Par powerlog dans le forum XMLRAD
    Réponses: 12
    Dernier message: 09/08/2005, 10h29
  5. [Quartz][Tomcat] Jobs.xml file not found exception
    Par Arnaud Giuliani dans le forum Tomcat et TomEE
    Réponses: 1
    Dernier message: 05/08/2005, 09h20

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