By the way, in case this gives you more information, my "DataPanel" is
very similar to the "OpenFlashChart" Panel class defined in
http://cwiki.apache.org/WICKET/open-flash-chart-and-wicket.html, as in
fact my flash object is Open Flash Chart (I am loading many charts in
the same page in an asynchronous way).

Regards,
Daniel.


2009/4/23 Daniel Fernandez <[email protected]>:
> Thank you again for your time, Igor.
>
> Your explanation makes sense by itself, but it is not my problem, I'm
> afraid... this thing can happen to me even the first time I load the
> page, without reloading at all.
>
> I investigated deeper and I realised that what was happening was that,
> when the server received the request from the flash object for
> retrieving the data (a request on the IResourceListener interface of
> the DataPanel)... the onBeforeRender() method of the outer container
> was being executed some times (and this onBeforeRender created a new
> LoadingPanel, which is what caused the exception)...  and this makes
> no sense to me.
>
> Let me put it clear, once loaded by the DataPanel onto the browser,
> the flash object requests:
>
> http://myserver/MyPage/wicket:interface/:5:outerpanel:panelloader:datapanel::IResourceListener::
>
> Which means that it is calling the datapanel which created the flash
> object itself as a resource listener, to simply obtain a resource
> declared there (a WebResource object) containing a String of data in
> JSON format.
>
> In my understanding this request, which is executed via the
> XmlHttpRequest object in the browser, should never provoke
> "outerpanel"'s onBeforeRender() method to execute... but it does! I
> put a log sentence in this onBeforeRender method which outputs
> "RequestCycle.get().getRequest().getURL()" and I receive an URL like
> the one above... but only sometimes, only when it fails.
>
> Is this possible, is there something I am not understanding about the
> way this URL should be served?
>
> Thanks again,
> Daniel.
>
>
>
>
> 2009/4/22 Igor Vaynberg <[email protected]>:
>> browsers are asynchronous, so you might have a race codition. eg
>> browser requests the data url and you press the refresh button, so now
>> there are two urls in the queue: the data and the page. if page is
>> processed first then the data url will fail because when the page is
>> first constructed you have a loading panel in there. makes sense?
>>
>> take a look at wicket's ajaxlazyloadingpanel, it might have a way to
>> handle this.
>>
>> -igor
>>
>> On Wed, Apr 22, 2009 at 10:23 AM, Daniel Fernandez
>> <[email protected]> wrote:
>>> Thanks for your answer, Igor.
>>>
>>> Now I know what is happening more in detail. It is not easy to
>>> explain, sorry for the long text:
>>>
>>> I have:
>>>
>>>  - DataPanel: a panel with data I want to show.
>>>
>>>  - LoadingPanel: a panel which just shows a "loading..." image.
>>>
>>>  - PanelLoader: a Panel with an inner panel called "content", which
>>> is loaded initially with LoadingPanel, and sets an AjaxTimerBehavior
>>> which polls the server until the data is ready, and then creates the
>>> DataPanel, replaces the inner "content" with this DataPanel, and stops
>>> the timer behavior.
>>>
>>>
>>> All this works perfectly until I use a subclass of DataPanel called
>>> FlashDataPanel which, for showing data, shows a flash object which in
>>> turn has to make a request from the browser to get its data. I offer
>>> this data to the flash object as a resource, by making this subclass
>>> of DataPanel implement IResourceListener, and implementing its
>>> "onResourceRequested" method. The URL I add to the flash object is
>>> obtained like:
>>>
>>>        CharSequence dataPath =
>>> RequestCycle.get().urlFor(FlashDataContainer.this,
>>> IResourceListener.INTERFACE);
>>>        return RequestUtils.toAbsolutePath( dataPath.toString() );
>>>
>>> The problems seems to be that *sometimes, and only sometimes* (maybe
>>> once each 50 correct loads or so), the "onResourceRequested" method
>>> gets called on the LoadingPanel instead of the DataPanel... which is
>>> something strange to my eyes (unless there is something I don't
>>> understand, of course). The URL is created passing the
>>> FlashDataContainer.this object, so I cannot understand how it gets
>>> called on a LoadingPanel, which of course does not implement
>>> IResourceListener, and thus provokes this exception.
>>>
>>> Regards,
>>> Daniel.
>>>
>>>
>>>
>>> 2009/4/22 Igor Vaynberg <[email protected]>:
>>>> why dont you set a breakpoint for classcastexception and see what it
>>>> is trying to cast to what.
>>>>
>>>> -igor
>>>>
>>>> On Wed, Apr 22, 2009 at 3:52 AM, Daniel Fernandez <[email protected]> 
>>>> wrote:
>>>>> Hello,
>>>>>
>>>>> I have a page which makes quite a heavy use of an
>>>>> AbstractAjaxTimerBehavior for retrieving the content of some Panels
>>>>> (and stops itself after the content is ready, like a sort of
>>>>> "polling") and I am getting a very strange exception which only seems
>>>>> to appear randomly:
>>>>>
>>>>>
>>>>> -------------
>>>>>
>>>>> 2009-04-22 12:21:30,592 ERROR [RequestCycle] (RequestCycle.java:1463)
>>>>> - Method onResourceRequested of interface
>>>>> org.apache.wicket.IResourceListener targeted at component
>>>>> [MarkupContainer [Component id = content]] threw an exception
>>>>> org.apache.wicket.WicketRuntimeException: Method onResourceRequested
>>>>> of interface org.apache.wicket.IResourceListener targeted at component
>>>>> [MarkupContainer [Component id = content]] threw an exception
>>>>>        at 
>>>>> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:199)
>>>>>        at 
>>>>> org.apache.wicket.request.target.component.BookmarkableListenerInterfaceRequestTarget.processEvents(BookmarkableListenerInterfaceRequestTarget.java:163)
>>>>>        at 
>>>>> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
>>>>>        at 
>>>>> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192)
>>>>>        at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
>>>>>        at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1370)
>>>>>        at org.apache.wicket.RequestCycle.request(RequestCycle.java:501)
>>>>>        at 
>>>>> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:455)
>>>>>        at 
>>>>> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:288)
>>>>>        at 
>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
>>>>>        at 
>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
>>>>>        at 
>>>>> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
>>>>>        at 
>>>>> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
>>>>>        at 
>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
>>>>>        at 
>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
>>>>>        at 
>>>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>>>>>        at 
>>>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
>>>>>        at 
>>>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
>>>>>        at 
>>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
>>>>>        at 
>>>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
>>>>>        at 
>>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
>>>>>        at 
>>>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
>>>>>        at 
>>>>> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
>>>>>        at 
>>>>> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
>>>>>        at 
>>>>> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
>>>>>        at 
>>>>> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
>>>>>        at java.lang.Thread.run(Thread.java:619)
>>>>> Caused by: java.lang.IllegalArgumentException:
>>>>> java.lang.classcastexcept...@42ae5f
>>>>>        at sun.reflect.GeneratedMethodAccessor38.invoke(Unknown Source)
>>>>>        at 
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAc1cessorImpl.java:25)
>>>>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>        at 
>>>>> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
>>>>>        ... 26 more
>>>>>
>>>>>
>>>>> -------------
>>>>>
>>>>>
>>>>> The problem is this I don't get more information than that, and I only
>>>>> get the exception once each, say... 50 times I reload the page (I mean
>>>>> "browser reload" = new page object). The other 49 times everything
>>>>> works fine. It's quite random...
>>>>>
>>>>> Any clues?
>>>>>
>>>>>
>>>>> Regards,
>>>>> Daniel.
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [email protected]
>>>>> For additional commands, e-mail: [email protected]
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>

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

Reply via email to