title: JSF 1.2 Exception Handling
body: <p>I am working on exception handling in our Application. I used try catch blocks to catch the exceptions occured in my code and i also could handle the time out exceptions by writing a listener and registering the listener in "faces-config.xml". </p>
  
  <p>But i am facing problems in catching unexpected errors like "NullPointerException" in constructor or error Codes 500, 400 etc. </p>
  
  <p>i used the tags in the "web.xml"</p>
  
  <pre><code>&lt;error-page&gt;
        &lt;exception-type&gt;java.lang.Exception&lt;/exception-type&gt;
        &lt;location&gt;/sc00/ErrorPage.jsp&lt;/location&gt;
  &lt;/error-page&gt;
  </code></pre>
  
  <p>I tried many ways to handle the exceptions, can any one help me in finding out a solution. The error i am getting when i try to handle these exceptions is as follows.</p>
  
  <p>I am using JSF 1.2 and the server is websphere 8</p>
  
  <p>The Console shows the Following Exception.</p>
  
  <pre><code>com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0014E: Uncaught service() exception root cause Faces Servlet: javax.servlet.ServletException
  
  E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: An exception was thrown by one of the service methods of the servlet [/sc00/ErrorPage.jsp] in application [MembershipEligibilityScreensEAR]. Exception created : [java.lang.RuntimeException: FacesContext not found
  </code></pre>
  
  <p>My Error Page is in /WebContent/sc00/ErrorPage.jsp, ErrorPage.jsp has no backing bean  associated with it.   </p>
  
  <p>Many solutions asked me to look at the URL path of Faces Servlet, In My web.xml the servlet-mapping is a follows</p>
  
  <pre><code> &lt;servlet&gt;
      &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;*.faces&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>all the paths in my faces-config.xml refer to /FolderName/JspName and they work fine and they work fine even in Navigation.xml.</p>
  
  <p>How can i navigate it to ErrorPage.jsp, Is there any way so that i can write a listener to this kind of problem</p>
  
  <p>Sorry for posting too many redundant questions, i am new to JSF and i don't know the rules of StackOverflow, I apologize for the problem i have caused.</p>
  
  <p>any solution would be appreciated.</p>