On Wed, Jan 18, 2012 at 12:39 PM, humcasma <[email protected]> wrote: > > Martin Grigorov-4 wrote >> >> Pastebin you code. >> > > While cleaning up the code to post it here I found a timer.stop() where it > should not be. After removing it, everything works as it should do. That is, > I create a new timer whenever the form is submitted, and add it to my > textarea component. The timer starts working, as well as the background > thread. When the latter is finished, I stop the timer and remove it from the > textarea from within the timer's onTimer() method. > I have noted that I need to stop the timer before I remove it. Otherwise I > get the exception below. It is really not a problem to stop the timer, but > since I am removing it anyway, I wonder if it should strictly be necessary > to do it. > > Cheers, > Humberto > > > ERROR - DefaultExceptionMapper - Unexpected error occurred > org.apache.wicket.WicketRuntimeException: Method onRequest of interface > org.apache.wicket.behavior.IBehaviorListener targeted at > com.telenor.claudia.web.gui.Index$StatusTimer@95ef17 on component [TextArea > [Component id = feedbackPanel]] threw an exception > at > org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:270) > at > org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241) > at > org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:255) > at > org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234) > at > org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750) > at > org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) > at > org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252) > at > org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209) > at > org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280) > at > org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162) > at > org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218) > at > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) > at > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360) > at > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) > at > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) > at > org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726) > at > org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) > at > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) > at org.mortbay.jetty.Server.handle(Server.java:324) > at > org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) > at > org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:829) > at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514) > at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) > at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) > at > org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228) > at > org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488) > Caused by: java.lang.reflect.InvocationTargetException > at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at > org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:260) > ... 25 more > Caused by: java.lang.IllegalStateException: Behavior must be added to > component before its id can be generated. Behavior: > com.telenor.claudia.web.gui.Index$StatusTimer@95ef17, Component: > org.apache.wicket.Behaviors@d91987 > at org.apache.wicket.Behaviors.getBehaviorId(Behaviors.java:252) > at org.apache.wicket.Component.getBehaviorId(Component.java:4436) > at org.apache.wicket.Component.urlFor(Component.java:3292) > at > org.apache.wicket.behavior.AbstractAjaxBehavior.getCallbackUrl(AbstractAjaxBehavior.java:89) > at > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getCallbackScript(AbstractAjaxTimerBehavior.java:125) > at
If you stop the timer behavior in onTimer() then #getJsTimeoutCall() wont be called at all. Check your code again and attach the debugger to see what happens. > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.getJsTimeoutCall(AbstractAjaxTimerBehavior.java:118) > at > org.apache.wicket.ajax.AbstractAjaxTimerBehavior.respond(AbstractAjaxTimerBehavior.java:155) > at > org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:316) > ... 29 more > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Update-component-after-background-thread-is-finished-tp4300126p4306383.html > Sent from the Users forum mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
