1

I am trying to use global error page for any kind of exception in a ADF/WebCenter application. In my web.xml I have this -

  <error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/faces/oracle/webcenter/portalapp/pages/error.jspx</location>
  </error-page>

On my page, I am using a managed bean to display some value:

<af:outputText value="#{mybean.value}" />

Here is example bean:

public class MyBean {
    private String value = null;
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public MyBean() throws MyAppException {
        calculateValue();
    }
    public void calculateValue() throws MyAppException {
        try { 
            // some business logic
        } catch (Exception e) {
            e.printStackTrace();
            throw new MyAppException();
        }
        setValue(1);
    }    
}

Now here when I intentionally throw some exception in my business logic in managed bean, I was expecting user to see error page as per my configuration.

However it's not working. It still shows same page without any content in browser but exception stack trace on console.

Where I am wrong?

pnuts
  • 58,317
  • 11
  • 87
  • 139
keeping_it_simple
  • 439
  • 1
  • 11
  • 31

1 Answers1

1

I think your problem has something to do with the location you use to reference your error page from web.xml.

So, if was in your position, i would put my error file under the Web Content directory and change my sub-tag as

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

And well, i would use an html page instead.

Bedir Yilmaz
  • 3,823
  • 5
  • 34
  • 54