Pessoal, estou tentando implementar um exemplo, simples com Maven + Jsf + TomCat, porém está dando um erro que não consigo descobrir. Já faz alguns dias que estou quebrando a cabeça porém não consigo resolver…procurei no Fórum problemas iguais mas não consegui resolver o meu será que alguem pode me ajudar ?
Acredito que o problema está no TomCat e o JSF, pois quando deixo meu index.jsp sem as tags do JSF funciona.
Segue o erro:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 4
1:<%@taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
2: <%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
3: <html>
4: <f:view>
5: <head>
6: <title>JSP Page</title>
7: </head>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.NullPointerException
com.sun.faces.taglib.jsf_core.ViewTag.doStartTag(ViewTag.java:162)
org.apache.jsp.index_jsp._jspx_meth_f_005fview_005f0(index_jsp.java:90)
org.apache.jsp.index_jsp._jspService(index_jsp.java:64)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.29 logs.
index.jsp (QUE DÁ O ERRO)
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<html>
<f:view>
<head>
<title>JSP Page</title>
</head>
<body>
<h1><h:outputText value="Hello World!"/></h1>
</body>
</f:view>
</html>
index.jsp (NÃO DÁ O ERRO)
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<html>
<head>
<title>JSP Page</title>
</head>
<body>
<p>Hello World!</p>
</body>
</html>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
Use this definition if using a Java EE 6 container This also stops
Eclipse from complaining that 3.0 is not a valid version <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">
-->
<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"
version="2.5">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>facelets.DEVELOPMENT</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>*.jsf</url-pattern>
</servlet-mapping>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<resource-env-ref>
<description>Object factory for the CDI Bean Manager</description>
<resource-env-ref-name>BeanManager</resource-env-ref-name>
<resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>
</resource-env-ref>
</web-app>
Já criei uma pasta lib no WEB-INF e coloquei os seguintes jars:
comons-beanutils.jar
commons-digester-2.1.jar
commons-logging-1.1.1.jar
jff-api-1.2.jar
jsf-impl-1.2-NIGHTLY_20060227.jar
Coloquei esses mesmos jars na pasta lib do eclipse.
Achando que pudesse ser isso criei ate um faces-config
<?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">
</faces-config>
Caso alguém puder me ajudar agradeço !