why should wicket handle exceptions like that, what kind? what should wicket
do then?

you should just be sure that you always can create an error page, we cant
help if that bombs out.

johan


On Thu, May 15, 2008 at 3:18 PM, Sergey Podatelev <
[EMAIL PROTECTED]> wrote:

> Yes, as I said in the previous message, I use SpringWebApplicationFactory.
> The problem, apparently, is that Spring wants to have a working database
> connection even when Wicket renders pages that doesn't access database in
> any way.
>
> Can Wicket handle a runtime exception like this?
>
>
> On Thu, May 15, 2008 at 3:46 PM, Johan Compagner <[EMAIL PROTECTED]>
> wrote:
>
> > ok somehow spring does something
> > Caused by:
> > org.springframework.transaction.CannotCreateTransactionException:
> > Could not open JDBC Connection for transaction; nested exception is
> > com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications
> > link
> >
> > So are you using some spring thing there?
> >
> >
> > On Thu, May 15, 2008 at 1:22 PM, Sergey Podatelev <
> > [EMAIL PROTECTED]> wrote:
> >
> > > The default stacktrace is listed below.
> > >
> > > Apparently, the error page won't load for the same reason original page
> > > wasn't loaded: Spring (which I also use) wants a Connection even for a
> > page
> > > that does not require any database interaction. This question is also
> > > bothering me, and although this is a Spring issue, perhaps someone of
> > > Wicket
> > > people could answer me since there so much examples of integration of
> > > Wicket
> > > and Spring.
> > >
> > > unexpected exception when handling another exception: Can't instantiate
> > > page
> > > using constructor public ru.vrgraphics.lianet.web.page.BaseErrorPage()
> > > org.apache.wicket.WicketRuntimeException: Can't instantiate page using
> > > constructor public ru.vrgraphics.lianet.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)
> > >         at org.apache.wicket.RequestCycle.step(RequestCycle.java:1248)
> > >        at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1330)
> > >        at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
> > >        at
> > >
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:358)
> > >        at
> > >
> > >
> >
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194)
> > >        at
> > >
> > >
> >
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> > >        at
> > >
> > >
> >
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> > >        at
> > >
> > >
> >
> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
> > >        at
> > >
> > >
> >
> org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
> > >        at
> > >
> > >
> >
> org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
> > >        at
> > >
> >
> org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
> > >        at
> > >
> > >
> >
> org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
> > >        at
> > >
> > >
> >
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> > >        at
> > >
> > >
> >
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> > >        at
> > >
> > >
> >
> org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
> > >        at
> > >
> > >
> >
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> > >        at
> > >
> > >
> >
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> > >        at
> > >
> > >
> >
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> > >        at
> > >
> > >
> >
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
> > >        at
> > >
> > >
> >
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> > >        at
> > >
> > >
> >
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> > >        at
> > >
> > >
> >
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> > >        at
> > >
> >
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
> > >        at
> > >
> >
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
> > >        at
> > >
> > >
> >
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
> > >        at
> > > org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> > >        at java.lang.Thread.run(Thread.java:619)
> > > Caused by: java.lang.reflect.InvocationTargetException
> > >        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> > > Method)
> > >        at
> > >
> > >
> >
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> > >        at
> > >
> > >
> >
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> > >        at
> java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> > >        at
> > >
> > >
> >
> org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:149)
> > >        ... 33 more
> > > Caused by:
> > > org.springframework.transaction.CannotCreateTransactionException:
> > > Could not open JDBC Connection for transaction; nested exception is
> > > com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications
> > > link
> > > failure
> > >
> > > On Thu, May 15, 2008 at 1:25 PM, Johan Compagner <[EMAIL PROTECTED]
> >
> > > wrote:
> > >
> > > > do you have more stacktrace like Cause : xxxxx
> > > >
> > > > On Thu, May 15, 2008 at 11:22 AM, Sergey Podatelev <
> > > > [EMAIL PROTECTED]> wrote:
> > > >
> > > > > 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
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > sp
> > >
> >
>
>
>
> --
> sp
>

Reply via email to