1.Define custom Faces Servlet that delegates the service to default faces servlet, javax.faces.webapp.FacesServlet, refer Mert's approach http://www.jroller.com/page/mert?entry=handling_errors_with_an_errror
2.Edit web.xml so that the default faces servlet javax.faces.webapp.FacesServlet is defined as old faces servlet(or some other name). Also define your own custom faces servlet as Faces Servlet. Now your web.xml faces servlet part looks like this:

Servlet mapping is not changed, follow instructions in Mert's article. The redundant servlet without mapping, javax.faces.webapp.FacesServlet is required evenif you do not use it to process any request and do not map any urls.
3. Add factory element in the faces-config.xml as follows:

4. Define a custom ServletContextListener class that implements ServletContextListener and add a listener element to web .xml.
5. Update the facelets.DEVELOPMENT parameter to make it false, if you are using facelets, this ensures redirection to error page.