Hello,

I have a custom error page BaseErrorPage:

public class BaseErrorPage extends WebPage {

    private final static long serialVersionUID = 1L;

    public BaseErrorPage() {
        super();
    }

    protected void configureResponse() {
        String acceptHeader = getWebRequestCycle().getWebRequest().
                getHttpServletRequest().getHeader("Accept");

        String contentType = ";charset=UTF-8";

        if (acceptHeader.contains("application/xhtml+xml")) {
            contentType = "application/xhtml+xml" + contentType;
        } else {
            contentType = "text/html" + contentType;
        }
        getResponse().setContentType(contentType);
    }
}

It's configured to be displayed in case of a runtime exception:

MyApplication.init():

...
getApplicationSettings().setInternalErrorPage(BaseErrorPage.class);
getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
...

I'm testing what happens if MySQL server goes down.
When it happens, first I got a SocketException which is caught and
BaseErrorPage is displayed.
But if I wait for a while (perhaps, until session expires?), I get just a
blank page in browser and in server log I see the following:

unexpected exception when handling another exception: Can't instantiate page
using constructor public com.mycorp.myapp.web.page.BaseErrorPage()
org.apache.wicket.WicketRuntimeException: Can't instantiate page using
constructor public com.mycorp.myapp.web.page.BaseErrorPage()
        at
org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:168)
        at
org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:58)
        at
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:262)
        at
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:283)
        at
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:231)
        at
org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:104)
        at org.apache.wicket.RequestCycle.respond(RequestCycle.java:1181)
        ...

Why does this happen and how can I prevent this?
I checked the DefaultPageFactory source and found that there's either an
Abort-, Initialization- or MarkupException, but I'm not sure how to deal
with any of those.

-- 
sp

Reply via email to