voyent
Icefaces 1.7.2 custom 500 error page + facelets  XML
Forum Index -> General Help
Author Message
rmeans

Joined: 10/Jul/2008 00:00:00
Messages: 40
Offline


I know this issue was said to have been resolved with this jira issue: http://jira.icefaces.org/browse/ICE-3007
but I can not seem to get my app to catch any errors besides 404's. I'm using facelets and I wonder if this is still an issue with facelets based apps?

Here's a snapshot of my web.xml
Code:
   <error-page>
     <error-code>500</error-code>
     <location>/error/error.jsp</location>
   </error-page>
   <error-page>
     <error-code>404</error-code>
     <location>/error/error.jsp</location>
   </error-page>
 


as you can see I have both 500 and 404 errors listed, however only the 404 issue works as a 500 error will show me the java blue screen of death instead of showing the error page.

I have verified that I am running icefaces 1.7.2 on this app. Any suggestions or has anybody got this to work with facelets?
rmeans

Joined: 10/Jul/2008 00:00:00
Messages: 40
Offline


any takers? I'm about to write a test app using facelets that throws a 500 service error and fails to catch it and submit it to the JIRA unless somebody sees something wrong here.
freetrax

Joined: 28/Nov/2007 00:00:00
Messages: 4
Offline


Hi rmeans, hi have very easy solution for catch error 500 and all jsp error.

1: Create new Java Class "PersistentFaces":

Code:
 package com.web;
 
 import com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet;
 import java.io.IOException;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 
 public class PersistentFaces extends PersistentFacesServlet {
 
     @Override
     public void service(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
         try {
             super.service(arg0, arg1);
         } catch (Exception ex) {
             arg0.getSession().invalidate(); 
             arg1.sendRedirect("/index.html");         
     // redirect only to other of jsf filter ( no *.jsp ...)
         }
     }
 
 }
 


2 : Into web.xml remove :
Code:
 <servlet>
         <servlet-name>Persistent Faces Servlet</servlet-name>
         <servlet-class>com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet</servlet-class>
 <load-on-startup>1</load-on-startup>
     </servlet>
 


and replace to :

Code:
 <servlet>
         <servlet-name>Persistent Faces Servlet</servlet-name>
         <servlet-class>com.web.PersistentFaces</servlet-class>
 <load-on-startup>1</load-on-startup>
     </servlet>
 


Is work good and is easy to use :)

xhavi

Joined: 06/Jan/2009 00:00:00
Messages: 7
Offline


i need to catch some NullPointer Exceptions, i have

Code:
    <error-page>
         <exception-type>java.lang.NullPointerException</exception-type>
         <location>/error.jsp</location>
     </error-page>


but is not working
 
Forum Index -> General Help
Go to:   
Powered by JForum 2.1.7ice © JForum Team