1 Reply Latest reply on Jun 29, 2010 3:47 PM by Bruno Krebs

    Seam Filter throwing breaking my application

    Bruno Krebs Newbie

      Hello there,


      everything was working just fine till I try to handle exceptions in my pages.xml. As far as I read I have to register seam filter to be able to handle exception in this xml and then redirect it to a page to warn the user right?


      So this is my web.xml with the seam filert:



      <?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">
       <description>Aplicação para controle do banco de produção da Fiergs</description>
       <display-name>Fiergs Faat</display-name>
       <!-- ==== Metadados da Aplicação ==== 
       Variáveis de Contexto -->
       <context-param>
        <description>Extensao das paginas</description>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.xhtml</param-value>
       </context-param>
       <filter>
        <filter-name>Seam Filter</filter-name>
        <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
       </filter>
       <filter-mapping>
        <filter-name>Seam Filter</filter-name>
        <url-pattern>*.seam</url-pattern>
       </filter-mapping>
       <!-- ==== Listeners ===== -->
       <listener>
        <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
       </listener>
       <!-- ==== Servlets ===== -->
       <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>*.seam</url-pattern>
       </servlet-mapping>
       <!-- ==== Configuração Geral da Aplicação ==== -->
       <session-config>
        <session-timeout>1</session-timeout>
       </session-config>
       <error-page>
        <exception-type>javax.faces.application.ViewExpiredException</exception-type>
        <location>/index.seam</location>
       </error-page>
       <login-config>
        <auth-method>BASIC</auth-method>
       </login-config>
      </web-app>



      With this seam filter when I try to access index.seam or any .seam page an exception is thrown, the exception is:


      org.ajax4jsf.resource.ResourceNotFoundException: Static resource not found for path /org/richfaces/renderkit/html/css/basic_classes.xcss
           org.ajax4jsf.resource.ResourceBuilderImpl.createStaticResource(ResourceBuilderImpl.java:463)
           org.ajax4jsf.resource.ResourceBuilderImpl.createResource(ResourceBuilderImpl.java:267)
           org.ajax4jsf.context.ViewResources.encodeSkinningResources(ViewResources.java:294)
           org.ajax4jsf.context.ViewResources.processHeadResources(ViewResources.java:510)
           org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:193)
           com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
           com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
           com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
           javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
           org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:706)
           org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:677)
           org.apache.jsp.index_jsp._jspService(index_jsp.java:54)
           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)
           org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
           org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
           org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
           org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
           org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
           org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
           org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
           org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
           org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
           org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
           org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
           org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      



      I'm using seam 2.2.0.GA, with tomcat 6, no jboss embedable and richfaces 3.3.3.Final.


      Without this seam filter my application works just fine, but when the session expires the stack trace is print in the web browser, and I wanted seam to redirect the user to the index page with a message.


      Just in case here is my pages.xml:


      <?xml version="1.0" encoding="UTF-8"?>
      <pages xmlns="http://jboss.com/products/seam/pages"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.2.xsd"
                no-conversation-view-id="/index.xhtml"
                login-view-id="/index.xhtml">
                
           <page view-id="/boletim/*" login-required="true"/>
                
           <page view-id="*">
              <navigation from-action="#{identity.logout}">
                  <redirect view-id="/index.xhtml"/>
              </navigation>
           </page>
           
           <page view-id="/index.xhtml">
                <navigation from-action="#{identity.login}">
                     <rule if="#{identity.loggedIn}">
                          <redirect view-id="/boletim/home.xhtml" />
                     </rule>
                </navigation>
           </page>
           
           <exception class="javax.faces.application.ViewExpiredException" log="false">
              <redirect view-id="/index.xhtml">
                  <message severity="WARN">Session timeout, you have been redirected to the start page.</message>
              </redirect>
          </exception>
      
      </pages>



      Does anyone know how to solve this?


      Thanks in advance,
      Bruno Krebs