Problema ao executar uma pagina com JSF2

2 respostas
farzac

Boa noite amigos

Estou tentando criar uma pagina simples com jsf2 porem ocorre o seguinte 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.NullPointerException
root cause

java.lang.NullPointerException
note The full stack traces of the exception and its root causes are available in the Oracle GlassFish Server 3.1 logs.

Eu importei para o lib do projetos os seguintes jar

commons-beanutils-1.8.0.jar
commons-collections-3.2.jar
commons-digester-2.0.jar
commons-logging-1.1.1.jar
jsf-api.jar
jsf-impl.jar
jstl-2.4.jar
jstl-impl.jar

O codigo do xml :

<?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_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>Proj2JSF</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <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>
  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
  <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>
</web-app>

O arquivo faces-config.xml esta assim:

<?xml version="1.0" encoding="UTF-8"?>

<faces-config
    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_2_0.xsd"
    version="2.0">

</faces-config>

Minha pagina index.jsp :

<%@ page language="java" contentType="text/html; charset=UTF-8" 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">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<f:view>
	Teste
</f:view>
</body>
</html>

Estou usando o servidor glassfish e java6

Sei que para muitos 'e uma besteira, pois 'e muito basico, mas tentei varios dias antes de vir aqui pedir ajuda.

Espero que alguem possa me dar uma luz.

Desde ja, muito obrigado.

2 Respostas

Luciano_Lopes

java.lang.NullPointerException acontece quando você chama algo que ainda não foi criado,verifique se vocẽ esta chamando algum objeto sem ter criado.

S

Acredito ser o mesmo problema deste: http://www.guj.com.br/java/247448-problema-com-aplicacao-jsf-com-hibernate#1283558

abraço

Criado 26 de junho de 2011
Ultima resposta 16 de jul. de 2011
Respostas 2
Participantes 3