Custom error page.........please help me

Hi guys,
i'm working on a jsf application and i've decided to use a custom error page.
What i want is displaying the stacktrace of the application level' exceptions like nullpointer,mysql exceptions etc....in a custom error page.
I've followed an example at the end of core java server faces book but it's doesn' work!!
Please help me,these are my steps...
i've defined in my web.xml
<servlet-mapping>
  <servlet-name>Faces Servlet</servlet-name>
  <url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
  <servlet-name>Faces Servlet</servlet-name>
  <url-pattern>*.faces</url-pattern>
</servlet-mapping>
  <error-page>
  <error-code>500</error-code>
  <location>/errorDisplay.jsp</location>
</error-page>i've errorDisplay.jsp
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<html>
<f:subview id="dummy">
<head>
  <title><h:outputText value="Problema nell'applicazione"/></title>
</head>
<body>
<h:form>
<p><h:outputText value="Un errore � stato riscontrato"/></p>
<p><h:outputText value="Ecco lo stacktrace"/></p>
<h:inputTextarea value="#{errorBean.stackTrace}"
rows="40" cols="80" readonly="true"/>
</h:form>
</body>
</f:subview>
</html>and this is my managed bean ErrorBean.java
package giu;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.sql.SQLException;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.servlet.ServletException;
public class ErrorBean {
     public String getStackTrace() {
          FacesContext context = FacesContext.getCurrentInstance();
          Map request = context.getExternalContext().getRequestMap();
          Throwable ex = (Throwable) request.get("javax.servlet.error.exception");
          StringWriter sw = new StringWriter();
          PrintWriter pw = new PrintWriter(sw);
          fillStackTrace(ex, pw);
          return sw.toString();
     private static void fillStackTrace(Throwable t, PrintWriter w) {
          if (t == null)
               return;
          t.printStackTrace(w);
          if (t instanceof ServletException) {
               Throwable cause = ((ServletException) t).getRootCause();
               if (cause != null) {
                    w.println("Root cause:");
                    fillStackTrace(cause, w);
          } else if (t instanceof SQLException) {
               Throwable cause = ((SQLException) t).getNextException();
               if (cause != null) {
                    w.println("Next exception:");
                    fillStackTrace(cause, w);
          } else {
               Throwable cause = t.getCause();
               if (cause != null) {
                    w.println("Cause:");
                    fillStackTrace(cause, w);
}I cause mysql exceptions in my application,but i see the standard stack trace,not my jsp page with stack trace..
i think my error is in web.xml in which 500 is only a type of error....i've to adding mysql exceptions????
How can i do it?
Please help me

I have the above solution working in my environment. the only difference is that i have an additional declaration in the deployment descriptor...
<error-page>
     <exception-type>java.lang.Exception</exception-type>
     <location>/faces/errorDisplay.jsp</location>
</error-page>

Similar Messages

  • My Ipad air continue to see error 4005, 4013, or 4014 when I try to restore . Although I did all the instructions in the help page , and I changed many computers  and I still get same errors . Please help.

    My Ipad air continue to see error 4005, 4013, or 4014 when I try to restore . Although I did all the instructions in the help page , and I changed many computers  and I still get same errors . Please help.
    Ipad air crushes and stuck in loop of apple logo then blue screen.

    If you get the same errors on different computer and with different computers then contact Apple : iOS: Restore errors 4005, 4013, and 4014 :
    If you continue to see error 4005, 4013, or 4014 when you restore your device, contact Apple for support.

  • Rendering an error-display - Please help!!

    Hi everyone,
    I'm about to give up. I use the Orion 1.5.2 appserver for EJB, JSP and servlets. It works great and is the best appserver i've tried so far. Except for one thing:
    As it seems, Orion doesn't have a custom error-page. When I invoke 'response.sendError(...)', Internet Explorer receives the status-code and displays its own error-page ("this site could not be reached"). Netscape displays some similiar page, showing the status-code and the attached message. But I want to show a custom error-page, that show more information about the message, and looks good as well. How can I accomplish that? I've looked through the forum and browsed through the documentation of Orion... nothing...
    Ohh, and one more thing... Does anyone know how to make orion use another database than HSQL for EJB's? I want to use MySQL with the MySQL J/Connector.
    Please help me!
    Nille

    Finally!!!
    Thank you very much.
    Would it be possible to accomplish something like this:
    <error-page>         
         <error-code>*</error-code>
         <location>/error.jsp</location>   
    </error-page>and the corresponding JSP:
    <%
       int errorCode = ((Integer)request.getParameter("status-code");
       String message = (String)request.getParameter("message");
    %>
    <HTML>
       <HEAD>
          <TITLE>Error <%= errorCode %></TITLE>
       </HEAD>
       <BODY>
          Status-code: <%= errorCode %><br>
          Cause: <%= message %>
       </BODY>
    </HTML>So that I have a generic error-page that renders all sendError invokations, and can fetch the status-code and the attached message.
    If a ServletException occures and I have a page that handles this exception, can I reach the exception from the error-page? Something like request.getAttribute("exception"), or something like that.
    Thank you alot for answering!
    Nille

  • Error in configuring Custom Error Pages for Faces Portlets

    According to
    http://e-docs.bea.com/wls/docs92/schemaref/controls-netuix/http.www.bea.com.servers.netuix.xsd.controls.netuix.1.0.0/element/facescontent.html
    you can specify an errorUri attribute on the facesContent object for the error page.
    <netuix:facesContent contentUri="/testList.jsp" errorUri="/error.jsp"/>
    WebLogic Workshop even allows setting this in the tool.
    However, the errorUri never gets picked up and the following error shows up.
    <BEA-423266> <No setter for property :: errorUri.>
    Anyone faced this problem. Is there any other alternative to specify a custom error page for JSF portlets.
    Please note that the errorUri works fine for the jspContent tag used for JSP Portlets.

    Hi Sanjeev,
    You need to check if you have access to AXF_CONFIGS table. Check if you have ran GRANT_ACCESS.sql script which has below grant commands.
    grant execute any type to apps;
    grant create type to AXF;
    grant select on AXF.AXF_CONFIGS to apps;
    v_formId AXF_CONFIGS.FORMID%TYPE; means tableName.columnName%type;
    so looks like when you are running AXF_EBS_SOLUTION_DATA.sql you are not able to access AXF_CONFIGS table.
    Hope this helps.
    Regards,
    Amol Gavali.

  • Error page? help!

    so.. when i tried to login to my account in a website.. i got the message i copied below. I never had problems going in it before. It happened right after I installed the latest firefox browser. I can't find the root directory they are talking about and dont really understand what to do. someone help me!
    Server Error in '/' Application.
    Runtime Error
    Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
    Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
    <!-- Web.Config Configuration File -->
    <configuration>
    <system.web>
    <customErrors mode="Off"/>
    </system.web>
    </configuration>
    Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
    <!-- Web.Config Configuration File -->
    <configuration>
    <system.web>
    <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
    </configuration>

    Same problem. Happened today as well... when trying to log into my MySpace account. Not sure what to do. I believe I had Firefox running at same time. But I did not install the lastest update... not today anyway.

  • Making a custom error page

    Hi could some please tell me the staps to setting up a
    customized error page on the server. My host has told me to go
    ahead and do it but im not really sure of the staps. I have made te
    page i want to use. Just not sure what to do next. Any help would
    be ,ost appreciated.
    Thanks Mark

    I would suggest to check Ray's great entry.
    http://www.coldfusionjedi.com/index.cfm/2007/12/5/The-Complete-Guide-to-Adding-Error-Handl ing-to-Your-ColdFusion-Application
    :)

  • Custom error Page when Run time Occurs in SharePoint

    Hi Guys In my SharePoint application in case if any Run time error occurs in my code, It should not come Server error \ ..instead it needs to redirect to Custom error Page But its not working Can you plz help out? I made changes in web.Config file but its
    not working..Can you guys plz help me out how to redirect to custom error Page if any run time error occurs in Sharepoint??
       <customErrors mode="RemoteOnly" defaultRedirect="~/GeneralError.htm" redirectMode="ResponseRedirect"></customErrors>
     [[ Web.config file in Virtual Directory C:/inetpub/wwwroot/vd/port/web.config
    Is there any changes in addition to this web.config file??
    Reddy

    Hi Reddy,
    Here you go. pls follow the tutorials
    http://www.fixthisbug.com/post/creating-a-custom-error-page-for-sharepoint-2010-web-application
    http://blog.incworx.com/blog/sharepoint-tips-and-tricks/implementing-sharepoint-2010-custom-error-pages-v3
    http://www.spdeveloper.co.in/articles/pages/custom-error-pages-for-sharepoint2010-sites.aspx
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • How can we define custom error page in protal application

    How can we define custom error page in protal application, like we define "jsp Error page " in JSPs

    Hi,
    Check these:
    Customization of Portal Runtime Errors and portal standard error codes
    http://help.sap.com/saphelp_nw04/helpdata/en/9a/e74d426332bd30e10000000a155106/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/ec/1273b2c413b2449e554eb7b910bce7/frameset.htm
    Regards,
    Praveen Gudapati

  • I want to give custome error page in web dynpro application

    Hi ,
    I want to give custom error page for time out condition in my web dynpro application  .
    Kindly give me a soulation ASAP.
    Thank's and regard's.
    Vikash.

    Refer this :
    default error page
    May be it helps you.

  • How to configure custom error page in WebServer 6.1 if instance is down

    Hi ,
    I have deployed an application on port 82.
    If the instance is down, want to configure custom error page in Sun One Webserver 6.1 so that the it displays a customised message rather than browser displaying its custom DNS error page.
    In web.xml, configured the 404/500 error messages, but if the instance is down, my web application does not receive the request. So it should be defined at the root level.Where to configure the same?
    Thanks for the help in advance.

    You can use Error function "send-error" http://docs.sun.com/source/817-1834-10/crobjsaf.html#wp20007
    It has an example
    Error fn=send-error code=401 path=/sun/server61/docs/errors/401.html

  • WWS-32136 UTL_HTTP error. Please help

    Hello,
    I am trying to get all content area content
    to show up inside the folder(or area). When I want to get WebDB reports or external sites
    to display within the content area, I get
    a utl_http error. Here is what I did:
    1. Create a Content Area
    2. Create an item or type URL
    3. Check the "link displays item in folder area" as the display options attribute.
    When I click on the link, webdb reports take
    up the entire page, while external url or
    external apps (like giving a link to www.oracle.com) ends up giving me a utl_http error.
    Please help !!
    Sanjay

    Sanjay
    Did you review the looking at the troubleshooting guide on OTN: http://technet.oracle.com/products/iportal/htdocs/portal_troubleshooting.htm
    Seaching this page using the keyword 'utl_http' returned a likely solution:
    Cause: This is most likely happening because of a bug in the UTL_HTTP package that shipped with early versions of the Oracle 8.1.6 database on Windows NT.
    Solution: You must download and install the 8.1.6.2 patch from http://metalink.oracle.com (click patches, and then select "product: Oracle Server - Enterprise Edition", "platform: MS Windows NT"). You must be registered to use Metalink.

  • Custom Error Pages (404 & 500) not invoked (JSF 1.2 & Websphere 6.0.1)

    Hopefully this is very obvious to some of the experts here. I'm trying to have my custom error pages (404 & 500) displayed, but in stead I get the normal system output text (ugly). The web.xml has been configured to apply the FacesServlet to all pages ending with "jspx". What I now get is the following: Whenever a page ending with .jspx cannot be found, the custom 404 page is IGNORED, however, when I don't use .jspx, but .jsp for example, IT WORKS. Below is my web.xml. I have already tried to make the error pages plain html, and also moved them to the root directory, no luck.
    Oh yes, running on RAD 6.0.1, Faces 1.2.
    Please if someone could guide me here...
    ########## SNIP ##########
    <servlet id="Servlet_1212573625706">
    <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>JS Resource Servlet</servlet-name>
    <url-pattern>/.ibmjsfres/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jspx</url-pattern>
    </servlet-mapping>
    <error-page>
    <error-code>500</error-code>
    <location>/includes/errorPages/error500.jspx</location>
    </error-page>
    <error-page>
    <error-code>404</error-code>
    <location>/includes/errorPages/error404.jspx</location>
    </error-page>
    ########## SNIP ##########

    I recognize this as an appserver bug (yeah, it's Websphere).
    Websphere (and the older versions of Apache Tomcat where it is actually based on) doesn't expect the error-page to be a dynamic servlet-served page, but as a static page. It roughly handles as follows: get the error-page location from web.xml, test its existence on the disk file system, if positive then go ahead, but if negative then display default error screen.
    The file with .jspx extension does not physically exist on the disk file system. A workaround for which I remember it worked in WAS 5.x is to create physically that file (empty content is allowed) on the disk file system. So create a blank file with jspx extension at the same location.

  • JSP error? Please help!

    JSP error? Please help!
    I am new to JSP, I got a project using jsp. So I tried something very simple, when I try to execute .jsp, I got the following error msg:
    Request URI:/ifs/jsp-bin/ifs-cts/stringjavajsp.jsp
    Exception:
    oracle.jsp.parse.JspParseException: Line # 9, Error: Unable to find class for bean: stringjsp defined by tag with class: strbuffer
    the part of .jsp as following:
    <%@ page import = "strbuffer" %>
    <%! String errString; boolean validation=false;%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>string manipulation</title>
    </head>
    <jsp:useBean id="stringjsp" scope="page" class="strbuffer" />
    <%
    String String1=request.getParameter("string1");
    String String2=stringjsp.stringappend(String1);
    %>
    The .java code as following:
    import java.lang.*;
    import java.util.*;
    public class strbuffer {
    public String stringappend(String string1) {
    String i=string1;
    StringBuffer j=new StringBuffer(i);
    j.setCharAt(2,'x');
    j.insert(5,'k');
    j.append("zzz");
    i=j.toString();
    System.out.println("the changed string is "+i);
    return i;

    Or maybe you've compiled your Bean class with the wrong package declaration. And make sure that you've compiled it with a directory structure matching your declared package.

  • Custom Error Pages Using .htaccess

    Hi All
    Im new to Ironport Nation and would like some help setting up custom error pages
    I have an Apache server setup with custom errors but am having trouble with my.htaccess and mod_rewrite i believe it needs to be something like
    URL
    http://proxy.rlc.qld.edu.au/errors/blocked.html?Time=30/Apr/2008:14:29:56%20+1000&ID=0004221698&Client_IP=10.0.0.13&User=-&Site=www.blodddddgstorm.co.uk&URI=htaccess-mod_rewrite-ultimate-guide/&Status_Code=503&Decision_Tag=OTHER&URL_Cat=nc&WBRS=dns&DVS_Verdict=0&DVS_ThreatName=-
    .htaccess
    rewriteEngine on
    rewriteCond %{query_string} ^URL_Cat=nc&WBRS=dns$
    rewriteRule ^errors$ http://proxy.rlc.qld.edu.au/errors/pagenotfound.html [R=301,L]
    redirects to
    http://proxy.rlc.qld.edu.au/errors/pagenotfound.html
    I would also like to incorporate
    URL_Cat=nc&WBRS=dns pagenotfound.html
    URL_Cat=Adul&WBRS=- adult.html
    URL_Cat=Game&WBRS=- games.html
    URL_Cat=C_Bloc&WBRS=- custom.html
    i know the .htaccess (mod_rewite) is wrong thats where i need help
    Thanks in advance
    Steve

    Is there a reason you're trying to use mod_rewrite to do this?
    The EUN redirection was designed to be directed to a CGI script, which can then dynamically generate the error page based on the criteria passed in, which allows you to customize the error returned (eg, you can list the full category name which is blocked, for example)
    If you really want to have it directing to a static page you can still do this in a CGI script rather than using mod_rewrite.
    If you get the config right then mod_rewrite should work, but it's almost certainly going to be overkill...

  • HT1933 I follow these steps but it redirects to me to itunes and says "Your request produced an error [newNullResponse] please help an expensive app was purchased and wasnt supposed too!

    I follow these steps but it redirects to me to itunes and says "Your request produced an error [newNullResponse] please help an expensive app was purchased and wasnt supposed too! I really need help asap

    Use this Link to Contact iTunes Customer Service and request assistance...
    Apple  Support  iTunes Store  Contact Us

Maybe you are looking for