2 Replies Latest reply on Aug 27, 2009 8:46 AM by Leo van den berg

    Seam Pages.xml exception handling

    soares gouveia Newbie

      Hi all,


      I'm trying to use the global pages.xml to redirect the user to an error page when some error happens.
      I'm calling a method of my backing bean that throws a NullPointerException,
      and in pages.xml I have this:


              <exception>
                      <redirect view-id="/public/home.xhtml">
                              <message severity="error">Unexpected error, please try again</message>
                      </redirect>
              </exception>



      But when the NullPointerException is throwed I have this stack trace and the pages.xml seems not work... I'm running the application on Tomcat 6. Any ideas?


      Thank you!


      javax.servlet.ServletException: java.lang.NullPointerException
              org.jboss.seam.web.ExceptionFilter.endWebRequestAfterException(ExceptionFilter.java:126)
              org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:70)
              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:178)
              org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
              org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
              org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
              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:58)
              org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)


      root cause


      java.lang.NullPointerException
              org.jboss.seam.navigation.Pages.getStringValuesFromModel(Pages.java:758)
              org.jboss.seam.navigation.Pages.encodePageParameters(Pages.java:937)
              org.jboss.seam.faces.FacesManager.redirect(FacesManager.java:176)
              org.jboss.seam.faces.Navigator.redirect(Navigator.java:55)
              org.jboss.seam.faces.Navigator.redirect(Navigator.java:42)
              org.jboss.seam.exception.RedirectHandler.handle(RedirectHandler.java:51)
              org.jboss.seam.exception.Exceptions.handle(Exceptions.java:76)
              org.jboss.seam.web.ExceptionFilter.endWebRequestAfterException(ExceptionFilter.java:114)
              org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:70)
              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:178)
              org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
              org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
              org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
              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:58)
              org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)