Re:HTTP Status 404 - /AulaJSF/olamundo.jsf, web.xml - filter

Pessoal,

Estou tentando rodar um pequeno exemplo, e esta dando o erro abaixo :

HTTP Status 404 - /AulaJSF/olamundo.jsf


type Status report

message /AulaJSF/olamundo.jsf

description The requested resource (/AulaJSF/olamundo.jsf) is not available.


<?xml version="1.0" encoding="ISO-8859-1" ?>
<html xmlns="http://www.w3.org/1999/xhtml"            
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
      <h:head>
         <title>
           Aula de Jsf
         </title>
      </h:head>
      
        <h:body>
        
           <h:outputText value="Bem vindo a aula" />
      
        </h:body>

</html>

no servidor não dá nenhum erro :

21/09/2012 17:39:24 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Arquivos de programas\Java\jre6\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Arquivos de programas/Java/jre7/bin/client;C:/Arquivos de programas/Java/jre7/bin;C:/Arquivos de programas/Java/jre7/lib/i386;C:\oraclexe\app\oracle\product\10.2.0\server\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Arquivos de programas\Internet Explorer;C:\Arquivos de programas\Microsoft SQL Server\90\Tools\binn;D:\java\instalacao\eclipse-jee-indigo-win32(2)\eclipse;;.
21/09/2012 17:39:25 org.apache.tomcat.util.digester.SetPropertiesRule begin
AVISO: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:intranet’ did not find a matching property.
21/09/2012 17:39:25 org.apache.tomcat.util.digester.SetPropertiesRule begin
AVISO: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:sistema venda java’ did not find a matching property.
21/09/2012 17:39:25 org.apache.tomcat.util.digester.SetPropertiesRule begin
AVISO: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:AulaJSF’ did not find a matching property.
21/09/2012 17:39:25 org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler [“http-bio-8057”]
21/09/2012 17:39:25 org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler [“ajp-bio-8009”]
21/09/2012 17:39:25 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 525 ms
21/09/2012 17:39:25 org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
21/09/2012 17:39:25 org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.12
21/09/2012 17:39:28 org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler [“http-bio-8057”]
21/09/2012 17:39:28 org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler [“ajp-bio-8009”]
21/09/2012 17:39:28 org.apache.catalina.startup.Catalina start
INFO: Server startup in 3054 ms

Tem certeza que esse é um projeto JSF?

Como você chama o /AulaJSF/olamundo.jsf ?
Mostre o seu web.xml
Qual versão do jsf ?
Tem alguma jsp que redireciona para a olamundo.jsf ?

sim , tenho ctz

Estou executando o alomundo direto

versao: 1.2 jsf
segue o web.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_2_5.xsd" 
         id="WebApp_ID" version="2.5">
  <display-name>AulaJSF</display-name>
  <welcome-file-list>
    <welcome-file>index.html</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>*.jsf</url-pattern>
  </servlet-mapping>
  
  <filter>
      <filter-name>HibernateFilter</filter-name>
      <filter-class>br.com.evandro.web.HibernateSessionRequestFilter</filter-class>
  </filter>
  
  <filter-mapping>
     <filter-name>HibernateFilter      </filter-name>
     <url-pattern>*.jsf</url-pattern>  
  </filter-mapping>
</web-app>

Descobri que é por causa do filtro no xml


    <filter>
      <filter-name>HibernateFilter</filter-name>
      <filter-class>br.com.evandro.web.HibernateSessionRequestFilter</filter-class>
  </filter>
  
  <filter-mapping>
     <filter-name>HibernateFilter      </filter-name>
     <url-pattern>*.jsf</url-pattern>  
  </filter-mapping>


classe HibernateSessionRequestFilter
package br.com.evandro.web;

import javax.servlet.*;

import org.hibernate.SessionFactory;
import br.com.evandro.util.HibernateUtil;

public class HibernateSessionRequestFilter implements Filter{
	private SessionFactory sf;
	public void init(FilterConfig config) throws ServletException{
		sf = HibernateUtil.getSf();
	}
	
	public void doFilter(ServletRequest sRq, ServletResponse sRp, FilterChain chain) throws ServletException {
		try
		{
			sf.getCurrentSession().beginTransaction();
			chain.doFilter(sRq, sRp);
			sf.getCurrentSession().getTransaction().commit();
			sf.getCurrentSession().close();
			
		} catch (Throwable e) {
			try {
				 if (sf.getCurrentSession().getTransaction().isActive()){
					 sf.getCurrentSession().getTransaction().rollback();
				 }
			} catch (Throwable ex) {
				ex.printStackTrace();
			}
			throw new ServletException(e);
		}
		
	}
	
	public void destroy(){
		
	}

}