Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9100709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:56:05+00:00 2026-06-17T00:56:05+00:00

i have ErrorPage.jsp in which i have <h:messages styleClass=messageError id=messages1></h:messages> when an Exception occurs

  • 0

i have ErrorPage.jsp in which i have

<h:messages styleClass="messageError" id="messages1"></h:messages>

when an Exception occurs in a backing beans constructor i catch it and i do the following

public constructorxxx throws Exception{
    // code 
// code 
// code
catch(Exception e){
try{
        LOG.error(e);
        String customMessage = "An Unknown Error At " + e.getStackTrace()[0].toString() +  "at" + message;

        getFacesContext().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, 
                customMessage, null));
throw new Exception();
                }catch (IOException exception){   
            LOG.error(exception);   
    } 
}
} // end of constructor

in my Web.xml i used the following tag.

<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/ErrorPage.jsp</location>    

when i do that i get the following errors

1) Uncaught service() exception root cause Faces Servlet: javax.servlet.ServletException
2) 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.

and in my page it displays as
SRVE0260E: The server cannot use the error page specified for your application to handle the Original Exception printed below.

Error Message: javax.servlet.ServletException
Error Code: 500
Target Servlet: Faces Servlet
Error Stack: 
java.lang.Exception 
// stack trace


Error Message: java.lang.RuntimeException: FacesContext not found
Error Code: 0
Target Servlet: 
Error Stack: 
java.lang.RuntimeException: FacesContext not found 

Many people asked me to change the location of the ErrorPage.jsp as /sc00/ErrorPage.faces but it shows a broken link warning on my web.xml and the error is webpage cannot be displayed and programming error.

I am using jsf 1.2 and my “ErrorPage.jsp” doesn’t have a backing bean.

can anyone suggest me why the the Error.jsp is not being displayed?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T00:56:06+00:00Added an answer on June 17, 2026 at 12:56 am

    Faces messages are request scoped, so they have the same lifetime as the current HTTP request-response cycle. However, you’re instructing the webbrowser to create a new HTTP request by sending a redirect. The faces messages are not there anymore in the new HTTP request.

    You’d better just throw an exception and associate the particular error page with the particular exception by <error-page> entry in web.xml. The servletcontainer will automatically forward to the particular error page within the same request.

    E.g.

    getFacesContext().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, customMessage, null));
    throw new SomeException();
    

    with

    <error-page>
        <exception-type>com.example.SomeException</exception-type>
        <location>/sc00/ErrorPage.faces</location>
    </error-page>
    

    But given that your particular container and JSF impl/version apparently can’t forward to a JSF based error page (is it running in an infinite loop?), then your best bet is to remove all JSF components from the error page (otherwise you will get RuntimeException: FacesContext not found) and make it a really plain vanilla JSP page with only HTML and JSTL.

    <error-page>
        <exception-type>com.example.SomeException</exception-type>
        <location>/sc00/ErrorPage.jsp</location>
    </error-page>
    

    You should only put the message in the exception itself instead of adding as faces message.

    throw new SomeException(customMessage);
    

    Then, you can display it in the error page as follows:

    ${requestScope['javax.servlet.error.message']}
    

    You could even just let the exception go (i.e. just redeclare it as throws in action method.

    public void doSomething() throws SomeException {
        // ...
    }
    

    The servletcontainer will automatically log it anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following web.xml <error-page> <error-code>500</error-code> <location>/WEB-INF/views/errorPages/500.jsp</location> </error-page> <error-page> <exception-type>java.lang.Exception</exception-type> <location>/WEB-INF/views/errorPages/error.jsp</location> </error-page> <error-page>
I have a JSP page which includes an iframe , Iframe contains the image
I have set my error page like this in web.xml: <error-page> <exception-type>java.lang.Exception</exception-type> <location>/errors/error.jsp</location> </error-page>
I have two jsp files as follow: myform.jsp <%@ page contentType='text/html; charset=UTF-8' errorPage='' %>
I am using Spring in my JSP project: I have following mapping for all
I have an application web.xml with the following entry: <error-page> <error-code>404</error-code> <location>/system_files/error/p_notfound.jsp</location> </error-page> However,
have written this little class, which generates a UUID every time an object of
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
Have deployed numerous report parts which reference the same view however one of them
I have a simple (Servlet, JSP, and JSTL) web app whose main functionality is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.