Quantcast

Getting more stale page exception in wicket 1.5.6

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Getting more stale page exception in wicket 1.5.6

sudeivas
Hey All,
     I just upgraded the application to wicket 1.5.6 from 1.5.4. I thought it will fix most of my page expiration issues. But now I am getting more stale page exceptions. Can you please help me to resolve this?

use case: After I click an Ajax Link, all I see in the logs is

WARN: org.apache.wicket.request.handler.request.WebPageRenderer - The Buffered response should be handled by BufferedResponseRequestHandler.

In the UI, nothing happens if I click the Ajax Link. Then if I try to click the link once again, then it runs into stale page exception.

Exception : org.apache.wicket.request.mapper.StalePageException

Exception Cause : null

Exception Stack Trace : org.apache.wicket.request.mapper.StalePageException
        at org.apache.wicket.request.handler.PageProvider.getStoredPage(PageProvider.java:301)
        at org.apache.wicket.request.handler.PageProvider.resolvePageInstance(PageProvider.java:257)
        at org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:165)
        at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.getPage(ListenerInterfaceRequestHandler.java:100)
        at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:165)
        at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:781)
        at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
        at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:255)
        at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
        at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283)
        at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:185)
        at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:241)
        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:191)
        at de.javakaffee.web.msm.SessionTrackerValve.invoke(SessionTrackerValve.java:147)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:615)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:662)


Thanks,
Suresh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Getting more stale page exception in wicket 1.5.6

vineetsemwal
read javadoc of  page#getrendercount()

On Thu, May 24, 2012 at 10:41 PM, sudeivas <[hidden email]> wrote:

> Hey All,
>     I just upgraded the application to wicket 1.5.6 from 1.5.4. I thought
> it will fix most of my page expiration issues. But now I am getting more
> stale page exceptions. Can you please help me to resolve this?
>
> use case: After I click an Ajax Link, all I see in the logs is
>
> WARN: org.apache.wicket.request.handler.request.WebPageRenderer - The
> Buffered response should be handled by BufferedResponseRequestHandler.
>
> In the UI, nothing happens if I click the Ajax Link. Then if I try to click
> the link once again, then it runs into stale page exception.
>
> Exception : org.apache.wicket.request.mapper.StalePageException
>
> Exception Cause : null
>
> Exception Stack Trace : org.apache.wicket.request.mapper.StalePageException
>        at
> org.apache.wicket.request.handler.PageProvider.getStoredPage(PageProvider.java:301)
>        at
> org.apache.wicket.request.handler.PageProvider.resolvePageInstance(PageProvider.java:257)
>        at
> org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:165)
>        at
> org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.getPage(ListenerInterfaceRequestHandler.java:100)
>        at
> org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:165)
>        at
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:781)
>        at
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>        at
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:255)
>        at
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
>        at
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283)
>        at
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:185)
>        at
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:241)
>        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:191)
>        at
> de.javakaffee.web.msm.SessionTrackerValve.invoke(SessionTrackerValve.java:147)
>        at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
>        at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>        at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:615)
>        at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>        at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
>        at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
>        at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
>        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
>        at java.lang.Thread.run(Thread.java:662)
>
>
> Thanks,
> Suresh
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Getting-more-stale-page-exception-in-wicket-1-5-6-tp4649492.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>



--
thank you,

regards,
Vineet Semwal

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Getting more stale page exception in wicket 1.5.6

sudeivas
Thanks for the information. But is there any way to prevent this exception or is there any way to recreate the page if this exception occurs?

Thanks,
Suresh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Getting more stale page exception in wicket 1.5.6

Martin Grigorov-4
Hi,

By default Wicket recreates the page when StalePageException occurs.
It wont recreate the page only if you handle this exception yourself
in IRequestCycleListener#onException().

The more interesting problem is why you get warnings like:
WARN: org.apache.wicket.request.handler.request.WebPageRenderer - The
Buffered response should be handled by BufferedResponseRequestHandler.

This means that BufferedResponseMapper doesn't work for some reason.
Put a breakpoint in BufferedResponseMapper#mapRequest() and click on the link.

On Mon, May 28, 2012 at 9:26 AM, sudeivas <[hidden email]> wrote:

> Thanks for the information. But is there any way to prevent this exception or
> is there any way to recreate the page if this exception occurs?
>
> Thanks,
> Suresh
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Getting-more-stale-page-exception-in-wicket-1-5-6-tp4649492p4649513.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>



--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Getting more stale page exception in wicket 1.5.6

sudeivas
Hello Martin,
         I am handling couple of other exceptions in my application. Below is my code,

getRequestCycleListeners().add(new AbstractRequestCycleListener() {
            @Override
            public IRequestHandler onException(final RequestCycle requestCycle, final Exception e) {
                LOGGER.error(e.getMessage(), e);
                Throwable cause = e;
                if (cause instanceof RedirectToUrlException) {
                    return new RedirectRequestHandler(Constants.MENU_URL);
                } else if (cause instanceof ListenerInvocationNotAllowedException) {
                    //catching this because auto-refresh is having some issue when the timer is stopped
                    //need to find some way to remove this
                    return new RenderPageRequestHandler(new PageProvider(ProblemIndexPage.class));
                }
                String uniqId = UUID.randomUUID().toString();
                LOGGER.error("ERROR UUID : " + uniqId);

                //redirect to the default error page
                return new RenderPageRequestHandler(new PageProvider(DefaultErrorPage.class));
            }

Will the above code block wicket to recreate the page when StalePageException occurs? If yes, how can I handle specific runtime exceptions.

Thanks,
Suresh

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Getting more stale page exception in wicket 1.5.6

Martin Grigorov-4
On Mon, May 28, 2012 at 6:26 PM, sudeivas <[hidden email]> wrote:

> Hello Martin,
>         I am handling couple of other exceptions in my application. Below
> is my code,
>
> getRequestCycleListeners().add(new AbstractRequestCycleListener() {
>            @Override
>            public IRequestHandler onException(final RequestCycle
> requestCycle, final Exception e) {
>                LOGGER.error(e.getMessage(), e);
>                Throwable cause = e;
>                if (cause instanceof RedirectToUrlException) {
>                    return new RedirectRequestHandler(Constants.MENU_URL);
>                } else if (cause instanceof
> ListenerInvocationNotAllowedException) {
>                    //catching this because auto-refresh is having some
> issue when the timer is stopped
>                    //need to find some way to remove this
>                    return new RenderPageRequestHandler(new
> PageProvider(ProblemIndexPage.class));
>                }
>                String uniqId = UUID.randomUUID().toString();
>                LOGGER.error("ERROR UUID : " + uniqId);
>
>                //redirect to the default error page
>                return new RenderPageRequestHandler(new
> PageProvider(DefaultErrorPage.class));

Here you return your error page for any exception that you don't handle earlier.
You better return null in this case.
Wicket will use IApplicationSettings.getInternalErrorPage() if the
exception is due to a problem in your application.


>            }
>
> Will the above code block wicket to recreate the page when
> StalePageException occurs? If yes, how can I handle specific runtime
> exceptions.
>
> Thanks,
> Suresh
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Getting-more-stale-page-exception-in-wicket-1-5-6-tp4649492p4649524.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>



--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Getting more stale page exception in wicket 1.5.6

sudeivas
I will change to the below code,
getRequestCycleListeners().add(new AbstractRequestCycleListener() {
            @Override
            public IRequestHandler onException(final RequestCycle requestCycle, final Exception e) {
                LOGGER.error(e.getMessage(), e);
                Throwable cause = e;
                if (cause instanceof RedirectToUrlException) {
                    return new RedirectRequestHandler(Constants.MENU_URL);
                } else if (cause instanceof ListenerInvocationNotAllowedException) {
                    //catching this because auto-refresh is having some issue when the timer is stopped
                    //need to find some way to remove this
                    return new RenderPageRequestHandler(new PageProvider(ProblemIndexPage.class));
                }
                String uniqId = UUID.randomUUID().toString();
                LOGGER.error("ERROR UUID : " + uniqId);
           
                return null;
            }

and then
getApplicationSettings().setInternalErrorPage(DefaultErrorPage.class);
getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);

By this way, I believe I redirect only if exception is RedirectToUrlException & ListenerInvocationNotAllowedException. For other runtime exceptions like StalePageException, PageExpiredException, ComponentNotFoundException I believe wicket will try to re-create the page. For any other runtime exception (eg. null pointer exception), wicket will show internal error page. Please correct me if I am missing something.

Thanks,
Suresh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Getting more stale page exception in wicket 1.5.6

sudeivas
With the above code changes, I made a simple test case,

1. Ajax Button which will throw StalePageException.
Result: The page reloaded itself without going to the error page.

2. Ajax Button which will throw PageExpiredException.
Result: Error page

3. Ajax Button which will throw ComponentNotFoundException.
Result: Error page

I believe for all the above use cases, the page should reload instead of going to the error page.

Please let me know if I missing something.

Thanks,
Suresh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Getting more stale page exception in wicket 1.5.6

Martin Grigorov-4
Hi,

It is a bit more complicated.

On Tue, May 29, 2012 at 7:00 PM, sudeivas <[hidden email]> wrote:
> With the above code changes, I made a simple test case,
>
> 1. Ajax Button which will throw StalePageException.
> Result: The page reloaded itself without going to the error page.
>
> 2. Ajax Button which will throw PageExpiredException.
> Result: Error page

This is correct.
Only MountedMapper can "revive" a page if
org.apache.wicket.settings.IPageSettings#setRecreateMountedPagesAfterExpiry()
is true.
This is because MountedMapper knows the Page's class and is able to
create a new instance.
If only the page id is available then we do not know which page class to use.

>
> 3. Ajax Button which will throw ComponentNotFoundException.
> Result: Error page

See the inline comments in
org.apache.wicket.request.handler.ListenerInterfaceRequestHandler#respond
for more info about this.

>
> I believe for all the above use cases, the page should reload instead of
> going to the error page.
>
> Please let me know if I missing something.

Advice: Avoid handling Wicket's internals in your code unless really necessary.

>
> Thanks,
> Suresh
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Getting-more-stale-page-exception-in-wicket-1-5-6-tp4649492p4649550.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>



--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Getting more stale page exception in wicket 1.5.6

sudeivas
I believe org.apache.wicket.settings.IPageSettings#setRecreateMountedPagesAfterExpiry() is default to true. So I didn't set anything in my application. I mounted all the pages. I am handling only couple of exceptions on my application and for others I just return 'null' in onException() method. Hope I am not doing anything wrong here.

-Suresh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Getting more stale page exception in wicket 1.5.6

sudeivas
But according the below link,
https://issues.apache.org/jira/browse/WICKET-4454

The page should be repainted instead of showing ComponentNotFoundException. I am using wicket 1.5.6. Why am I seeing ComponentNotFoundException? Anyway to fix this?

-Suresh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Getting more stale page exception in wicket 1.5.6

sudeivas
In reply to this post by Martin Grigorov-4
Hello Martin

I think I found why I see the warning

WARN: org.apache.wicket.request.handler.request.WebPageRenderer - The
Buffered response should be handled by BufferedResponseRequestHandler.

I am having a code like,

setResponsePage(ProblemIndexPage.class);

inside an Panel (last line). This is a hidden widget. Whenever I call this widget, it will perform some task and redirect to the home page.

When I call this panel first time, it shows the warning. Then if I try to call it once again, then it says ComponentNotFoundException.

Is there a better way to redirect rather than setResponsePage ?

In my application I have already mounted the home page,
mountPage("/main", ProblemIndexPage.class);

Thanks,
Suresh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Getting more stale page exception in wicket 1.5.6

Martin Grigorov-4
Hi,

Which version of Wicket do you use ?

On Thu, May 31, 2012 at 8:31 PM, sudeivas <[hidden email]> wrote:

> Hello Martin
>
> I think I found why I see the warning
>
> WARN: org.apache.wicket.request.handler.request.WebPageRenderer - The
> Buffered response should be handled by BufferedResponseRequestHandler.
>
> I am having a code like,
>
> setResponsePage(ProblemIndexPage.class);
>
> inside an Panel (last line). This is a hidden widget. Whenever I call this

I'm not sure what do you mean by "last line". In the constructor ? In
another method ?

> widget, it will perform some task and redirect to the home page.
>
> When I call this panel first time, it shows the warning. Then if I try to
> call it once again, then it says ComponentNotFoundException.
>
> Is there a better way to redirect rather than setResponsePage ?

You can use : throw RestartResponseException(ProblemIndexPage.class)

>
> In my application I have already mounted the home page,
> mountPage("/main", ProblemIndexPage.class);

Create a quickstart app with 1.5.6 that reproduces the problem and
attach it to Jira.

>
> Thanks,
> Suresh
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Getting-more-stale-page-exception-in-wicket-1-5-6-tp4649492p4649629.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>



--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...