Galera, estou tentando mexer com JSF e GlassFish2.1, porém estou tendo um problema do qual não consigo sair.
Criei um projeto web no NetBeans 6.7.1 e adicionei os framework JavaServer Faces e o Facelets.
As bibliotecas adicionadas pelo netbeans, foram: [color=green]Facelets 1.1.1.4 - jsf-facelets.jar e Facelets 1.1.1.4 - el-impl-1.0.jar[/color] .
As bibliotecas JSF 1.2 também foram adicionadas.
O que acontece é que quando tendo rodar o projeto inicial, acontece esse erro:
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: java.lang.RuntimeException: Cannot find FacesContext
root cause
java.lang.RuntimeException: Cannot find FacesContext
note The full stack traces of the exception and its root causes are available in the Sun GlassFish Enterprise Server v2.1 logs.
Sun GlassFish Enterprise Server v2.1
E não mexi em nada, simplesmente mandei rodar.
Dai, se no arquivo WelcomeJSF.jsp eu comento as linhas de codigo da biblioteca jsf, dai roda:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%--
This file is an entry point for JavaServer Faces application.
--%>
<%--<f:view>--%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>JSP Page</title>
</head>
<body>
<%--<h1><h:outputText value="JavaServer Faces"/></h1>--%>
</body>
</html>
<%--</f:view>--%>
Porem se descomentar, não roda, dá o erro acima.
Meu arquivo faces-config.xml:
<?xml version='1.0' encoding='UTF-8'?>
<!-- =========== FULL CONFIGURATION FILE ================================== -->
<faces-config version="1.2"
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-facesconfig_1_2.xsd">
<application>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
</faces-config>
e o web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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_2_5.xsd">
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>facelets.SKIP_COMMENTS</param-name>
<param-value>true</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>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>welcomeJSF.jsp</welcome-file>
</welcome-file-list>
</web-app>
Alguém saberia como resolver esse problema? Já tentei de tudo e não consigo, quando coloco código JSF, sempre dá erro na pagina.
[color=darkred]
Resolvi esse problema retirando a Biblioteca Facelets que tinha incluído no projeto.
[/color]