Wicket 9.9.1: Unexpected RuntimeException Last cause: Component 'x:x' has been removed from page

210 Views Asked by At

I have a Wicket 9.1.1 application, running under Java 11 and Payara 5.201.

The latest version of this application is currently being tested by a professional tester prior to release. His work style seems to involve a certain amount of testing to destruction! He typically opens multiple tabs, lets his session expire in some of them, opens and works in new tabs, and then returns to the expired tab and clicks on links, etc. Normally, maybe 99% of the time, the behaviour of these expired tabs is exactly what you want, i.e. the user is redirected to a "Session Expired" page.

However, very occasionally and intermittently, a "Component has been removed from page" error occurs (see stack trace below). Each time, the component that was removed was a Link. I have now just managed to reproduce this myself.

Sample steps to reproduce the exception

The situation is a page shown to users immediately after they log in, presenting them with a table containing a list of tasks, one per row. There is a link for each task, which leads the user to a data-entry form to fill in. Some users may have multiple pending tasks at any particular moment, and other users may have none. My two sample users are called user9 and user18.

  1. I logged in as user9 (note, this user has multiple pending tasks).

  2. I duplicated my current tab.

  3. In the duplicated tab, I logged out.

  4. I logged in again as user18 (note, this user has no pending tasks).

  5. I returned to my original tab, where the list of user9's pending tasks is displayed.

  6. I clicked on the "Ready" link for a task.

  7. The error occurred.

Here is the stack trace from the exception:

Unexpected RuntimeException Last cause: Component 'entries:body:rows:12:cells:5:cell:link' has been removed from page.

Stacktrace Root cause:

org.apache.wicket.core.request.handler.ComponentNotFoundException: Component 'entries:body:rows:12:cells:5:cell:link' has been removed from page. at org.apache.wicket.core.request.handler.ListenerRequestHandler.respond(ListenerRequestHandler.java:166) at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:910) at org.apache.wicket.request.RequestHandlerExecutor.execute(RequestHandlerExecutor.java:63) at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:294) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:255) at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:277) at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:208) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:307) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:253) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:211) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:757) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:577) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:158) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:371) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238) at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:520) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:217) at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:182) at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:156) at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:218) at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:260) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:177) at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:109) at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:88) at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:524) at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:94) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:33) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:114) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549) at java.base/java.lang.Thread.run(Thread.java:834)

Connection to StalePageException

It seems like Wicket has refreshed the tab after a StalePageException, then found that the link which it is now expected to follow is no longer on the page.

0

There are 0 best solutions below