[jboss][eclipse][jsf][richfaces] problème pour initialiser mon projet
Bonjour, je suis débutant en Java, surtout en Java pour le web.
J'ai pour but de tester le Framework Richfaces. Pour essayer de résoudre mon problème ensemble, je vais vous détailler toute ma démarche afin de vous fournir le maximum d'informations possible.
Premièrement, je travaille sous Ubuntu (9.10). J'ai téléchargé et copié Jboss 5.1 dans /opt/jboss. J'ai ensuite téléchargé et copié la dernière version d'eclipse (version JEE IDE Developper) dans /opt/eclipse.
Dans mon workspace fraichement créé, ajouté un serveur "Jboss 5.0", que j'ai démarré en debugging. J'ai vérifié, je peux naviguer sur http://localhost:8080/ (jmx-console ou admin-console par exemple).
Suite à ça, j'ai créé un nouveau projet "Dynamic Web Projet" nommé "TestRichfaces" dans Eclipse.
Dans mon dossier WebContent/WEB-INF/lib/ j'ai les librairies suivantes :
$ find . -type f
./el-ri.jar
./richfaces-api-3.3.2.GA.jar
./commons-digester-2.0.jar
./richfaces-ui-3.3.2.GA.jar
./commons-collections-3.2.1.jar
./richfaces-impl-3.3.2.GA.jar
./commons-beanutils-1.8.2.jar
./commons-logging-1.1.1.jar
./standard.jar
./jsf-facelets-1.1.15.jar
J'ai ensuite édité mon fichier web.xml ce qui donne le résultat suivant (version intégrale du fichier) :
Citation:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>TestRichfaces</display-name>
<welcome-file-list>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>classic</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
<param-value>com.sun.facelets.FaceletViewHandler</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
</web-app>
J'ai ensuite ajouté un fichier faces-config.xml dont voici le contenu :
Citation:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xi="http://www.w3.org/2001/XInclude" 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-facesconfig_1_2.xsd">
<application>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
</faces-config>
Suite à ça, j'ai créé une JSP qui me redirigera vers ma JSF, si j'arrive sur l'application sans préciser de fichier, voici le contenu de mon fichier default.jsp :
Citation:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head></head>
<body>
<jsp:forward page="/start.jsf" />
</body>
</html>
J'ai finalement ajouté mon dernier fichier start.xhtml :
Citation:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<head>
<title>RichFaces</title>
</head>
<body>
1 + 1 = #{1+1}
<br />
<rich:calendar></rich:calendar>
<br />
<rich:panel>
<f:facet name="header">JBoss RichFaces</f:facet>
Looks like you are up and running...
</rich:panel>
</body>
</html>
Tout fier de moi, et plein d'espoir, je déploie, ce qui se passe sans soucis :
Citation:
14:51:32,301 INFO [TomcatDeployment] deploy, ctxPath=/TestRichfaces
14:51:32,887 INFO [config] Initializing Mojarra (1.2_12-b01-FCS) for context '/TestRichfaces'
Et c'est une fois que j'accède à ma JSF (soit par une des URLs suivantes : http://localhost:8080/Richfaces ou http://localhost:8080/Richfaces/start.jsf ou http://localhost:8080/Richfaces/faces/start.xhtml) que j'obtient l'exception suivante :
Citation:
14:53:28,975 ERROR [[Faces Servlet]] "Servlet.service()" pour la servlet Faces Servlet a généré une exception
java.lang.NullPointerException
at java.lang.String.startsWith(String.java:1421)
at java.lang.String.startsWith(String.java:1450)
at org.ajax4jsf.webapp.WebXml.getFacesResourceKey(WebXml.java:189)
at org.ajax4jsf.webapp.WebXml.getFacesResourceKey(WebXml.java:222)
at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:139)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:508)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
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:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
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:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Pourriez-vous m'éclairer sur quelque chose que j'aurais oublié, ou mal fait ?
Je suis biensûr disponible pour tout autre complément d'information au sujet des versions des différents composants de mon environnement. Je ne comprends vraiment pas ce qu'il se passe.
Merci d'avance pour vos réponses,
Cordialement,
Thomas