Précédent   Forum du club des développeurs et IT Pro > Java > Serveurs, conteneurs, et Java EE > JBoss
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse
 
Outils de la discussion
Publicité
'
Vieux 17/06/2009, 11h10   #1
moha_alnif
Nouveau Membre du Club
 
Étudiant
Inscription : avril 2009
Messages : 83
Détails du profil
Informations personnelles :
Localisation : Maroc

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : avril 2009
Messages : 83
Points : 26
Points : 26
Par défaut Erreur "java.lang.RuntimeException: Cannot find FacesContext"

bonjour
je suis débutant en developpement web et j'ai commencé par le fameux "hello world"
j'utilise Jboss4.2.3.GA et netbeans6.0
mon web.xml est le suivant :
Code :
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="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
    </context-param>
    <servlet>
        <servlet-name>FacesServlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>FacesServlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>
</web-app>
mon faces-config.xml :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
 
<?xml version="1.0" encoding="UTF-8"?>
 
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
<faces-config>
    <application>
        <locale-config>
            <default-locale>fr</default-locale>
        </locale-config>
    </application>
</faces-config>
mon jboss-web.xml:
Code :
1
2
3
4
5
6
 
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
  <security-domain flushOnSessionInvalidation="false"/>
  <context-root>/exemple_jsf</context-root>
</jboss-web>
ma page weg "index.jsp:
Code :
1
2
3
4
5
6
7
 
<%@ page contentType="text/html" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="html" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="core" %>
<core:view>
   <html:outputText value="Hello le World ! (en JSF !)" />
</core:view>
et l'erreure qui apparut lorsque j'execute mon projet "exemple-jsf" est la suivant :
Code :
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
 
09:45:58,812 ERROR [[jsp]] "Servlet.service()" pour la servlet jsp a généré une exception
java.lang.RuntimeException: Cannot find FacesContext
        at javax.faces.webapp.UIComponentClassicTagBase.getFacesContext(UIComponentClassicTagBase.java:1855)
        at javax.faces.webapp.UIComponentClassicTagBase.setJspId(UIComponentClassicTagBase.java:1672)
        at org.apache.jsp.index_jsp._jspx_meth_core_005fview_005f0(index_jsp.java:88)
        at org.apache.jsp.index_jsp._jspService(index_jsp.java:64)
        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:373)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
        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.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
        at java.lang.Thread.run(Thread.java:619)
merci pour votre aide
moha_alnif est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 17/06/2009, 14h41   #2
tchize_
Expert Confirmé Sénior
 
Avatar de tchize_
 
Homme
Responsable de service informatique
Inscription : avril 2007
Messages : 18 280
Détails du profil
Informations personnelles :
Sexe : Homme
Âge : 33
Localisation : Belgique

Informations professionnelles :
Activité : Responsable de service informatique
Secteur : Service public

Informations forums :
Inscription : avril 2007
Messages : 18 280
Points : 32 756
Points : 32 756
Envoyer un message via MSN à tchize_ Envoyer un message via Skype™ à tchize_
as-tu bien utilisé /faces/index.jsp et non pas /index.jsp pour accéder à ta page?
__________________
⥀⥁ Чиз faq java, cours java, javadoc. Pensez à et
Laisse entrer le jour après une nuit sombre. Si tu es toujours là, tu n'es pas faite pour mourir.
tchize_ est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/06/2009, 15h14   #3
moha_alnif
Nouveau Membre du Club
 
Étudiant
Inscription : avril 2009
Messages : 83
Détails du profil
Informations personnelles :
Localisation : Maroc

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : avril 2009
Messages : 83
Points : 26
Points : 26
bonjour
merci tchez pour ta réponse
j'ai essayer ce que tu ma proposé mais le meme problème qu'avant ,
je crois que le problème vient du la page index.jsp mais je sais pas ou exactement
merci de m'aider
moha_alnif est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/06/2009, 16h00   #4
tchize_
Expert Confirmé Sénior
 
Avatar de tchize_
 
Homme
Responsable de service informatique
Inscription : avril 2007
Messages : 18 280
Détails du profil
Informations personnelles :
Sexe : Homme
Âge : 33
Localisation : Belgique

Informations professionnelles :
Activité : Responsable de service informatique
Secteur : Service public

Informations forums :
Inscription : avril 2007
Messages : 18 280
Points : 32 756
Points : 32 756
Envoyer un message via MSN à tchize_ Envoyer un message via Skype™ à tchize_
Ce message d'erreur apparait quand tu ne passe pas par la servlet JSF. Pour passer par la servlet il faut utiliser une url qui correspond au mapping de la servlet. La page jsp en elle même n'a aucune influence là dessus
__________________
⥀⥁ Чиз faq java, cours java, javadoc. Pensez à et
Laisse entrer le jour après une nuit sombre. Si tu es toujours là, tu n'es pas faite pour mourir.
tchize_ est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 22/06/2009, 11h03   #5
moha_alnif
Nouveau Membre du Club
 
Étudiant
Inscription : avril 2009
Messages : 83
Détails du profil
Informations personnelles :
Localisation : Maroc

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : avril 2009
Messages : 83
Points : 26
Points : 26
Bonjour
merci tchez pour votre aide , effectivement pour accéder a ma page il faut utiliser l'url correspondant au mapping du la servlet c-a-d :
Code :
1
2
 
http://localhost:8080/exemple_jsf/faces/index.jsp
et si on veux élèminer le "faces" dans l'url , on doit modifier le mapping de la servlet , est ce que vous pouver m'indiquer comment
merci
moha_alnif est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 22/06/2009, 11h33   #6
tchize_
Expert Confirmé Sénior
 
Avatar de tchize_
 
Homme
Responsable de service informatique
Inscription : avril 2007
Messages : 18 280
Détails du profil
Informations personnelles :
Sexe : Homme
Âge : 33
Localisation : Belgique

Informations professionnelles :
Activité : Responsable de service informatique
Secteur : Service public

Informations forums :
Inscription : avril 2007
Messages : 18 280
Points : 32 756
Points : 32 756
Envoyer un message via MSN à tchize_ Envoyer un message via Skype™ à tchize_
tu peux par exemple mapper ta servlet sur *.jsf et utiliser comme url

Code :
http://localhost:8080/exemple_jsf/index.jsf
__________________
⥀⥁ Чиз faq java, cours java, javadoc. Pensez à et
Laisse entrer le jour après une nuit sombre. Si tu es toujours là, tu n'es pas faite pour mourir.
tchize_ est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 22/06/2009, 11h48   #7
moha_alnif
Nouveau Membre du Club
 
Étudiant
Inscription : avril 2009
Messages : 83
Détails du profil
Informations personnelles :
Localisation : Maroc

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : avril 2009
Messages : 83
Points : 26
Points : 26
merci tchez
donc je dois changer l'extension de la page index par .jsf au lieu de .jsp avant de changer le mapping
moha_alnif est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 22/06/2009, 13h10   #8
tchize_
Expert Confirmé Sénior
 
Avatar de tchize_
 
Homme
Responsable de service informatique
Inscription : avril 2007
Messages : 18 280
Détails du profil
Informations personnelles :
Sexe : Homme
Âge : 33
Localisation : Belgique

Informations professionnelles :
Activité : Responsable de service informatique
Secteur : Service public

Informations forums :
Inscription : avril 2007
Messages : 18 280
Points : 32 756
Points : 32 756
Envoyer un message via MSN à tchize_ Envoyer un message via Skype™ à tchize_
non, juste l'url.
__________________
⥀⥁ Чиз faq java, cours java, javadoc. Pensez à et
Laisse entrer le jour après une nuit sombre. Si tu es toujours là, tu n'es pas faite pour mourir.
tchize_ est déconnecté   Envoyer un message privé Réponse avec citation 10
Vieux 22/06/2009, 13h19   #9
moha_alnif
Nouveau Membre du Club
 
Étudiant
Inscription : avril 2009
Messages : 83
Détails du profil
Informations personnelles :
Localisation : Maroc

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : avril 2009
Messages : 83
Points : 26
Points : 26
merci tchize pour ton aide
oui j'ai changer le l'url est ca marche bien
merci encore
moha_alnif est déconnecté   Envoyer un message privé Réponse avec citation 10
Vieux 06/12/2012, 22h40   #10
rahmaniaymen
Invité régulier
 
Inscription : septembre 2012
Messages : 12
Détails du profil
Informations forums :
Inscription : septembre 2012
Messages : 12
Points : 7
Points : 7
Citation:
Envoyé par moha_alnif Voir le message
merci tchize pour ton aide
oui j'ai changer le l'url est ca marche bien
merci encore
bonjour
dsl j'ai le même problème et je veux que ça sera d'une manière automatique le mapping entre jsp et jsf
comment ça se fait SVP
merci d'avance
rahmaniaymen est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Cette discussion est résolue.
Outils de la discussion

Navigation rapide


Fuseau horaire GMT +2. Il est actuellement 02h56.


 
 
 
 
Partenaires

Hébergement Web