You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by YK <li...@yahoo.fr> on 2012/03/05 22:38:05 UTC

org.apache.wicket.WicketRuntimeException: There is no application attached to current thread

Hi,

I'm trying to make example using wicket 1.5.4 and spring work but I keep
having this exception: org.apache.wicket.WicketRuntimeException: There is no
application attached to current thread...

My example defines also a servlet filter that is applied just after the
WicketFilter in web.xml.
This filter uses ThreadLocal to set/unset a variable around each
request/response cycle.

I've noticed that if I disable the filter, my example works fine, but I
really need it to to pass a variable via the ThreadLocal: (static final
ThreadLocal<Map&lt;String, Serializable>> THREAD_OBJECT_CONTEXT = new
ThreadLocal<Map&lt;String, Serializable>>();)


Any idea about why wicket fails to accept such a filter please?

Is there a workaround please?


Thanks

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-WicketRuntimeException-There-is-no-application-attached-to-current-thread-tp4447781p4447781.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: org.apache.wicket.WicketRuntimeException: There is no application attached to current thread

Posted by YK <li...@yahoo.fr>.
@Dan,

Thank you so much for your help!

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-WicketRuntimeException-There-is-no-application-attached-to-current-thread-tp4447781p4451269.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: org.apache.wicket.WicketRuntimeException: There is no application attached to current thread

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Wicket will not call the next filter in the chain if the request is
processed by Wicket itself.
I think you should move your logic to IRequestCycleListener
#onBeginRequest/onEndRequest() if you need access to Wicket's TLs.

On Tue, Mar 6, 2012 at 12:55 AM, James Carman
<ja...@carmanconsulting.com> wrote:
> Make sure your filter mapping for your other filter is after the
> mapping for wicket filter.
>
> On Mon, Mar 5, 2012 at 5:17 PM, Dan Retzlaff <dr...@gmail.com> wrote:
>> If your ThreadLocal is needed within Wicket, shouldn't your filter run
>> *before* WicketFilter?
>>
>> Does your filter use any Wicket classes that require something in
>> o.a.w.ThreadContext?
>>
>> The basic design should work. We use a filter to manage a ThreadLocal
>> Hibernate Session for open-session-in-view.
>>
>> On Mon, Mar 5, 2012 at 1:38 PM, YK <li...@yahoo.fr> wrote:
>>
>>> Hi,
>>>
>>> I'm trying to make example using wicket 1.5.4 and spring work but I keep
>>> having this exception: org.apache.wicket.WicketRuntimeException: There is
>>> no
>>> application attached to current thread...
>>>
>>> My example defines also a servlet filter that is applied just after the
>>> WicketFilter in web.xml.
>>> This filter uses ThreadLocal to set/unset a variable around each
>>> request/response cycle.
>>>
>>> I've noticed that if I disable the filter, my example works fine, but I
>>> really need it to to pass a variable via the ThreadLocal: (static final
>>> ThreadLocal<Map&lt;String, Serializable>> THREAD_OBJECT_CONTEXT = new
>>> ThreadLocal<Map&lt;String, Serializable>>();)
>>>
>>>
>>> Any idea about why wicket fails to accept such a filter please?
>>>
>>> Is there a workaround please?
>>>
>>>
>>> Thanks
>>>
>>> --
>>> View this message in context:
>>> http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-WicketRuntimeException-There-is-no-application-attached-to-current-thread-tp4447781p4447781.html
>>> Sent from the Users forum mailing list archive at Nabble.com.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: org.apache.wicket.WicketRuntimeException: There is no application attached to current thread

Posted by James Carman <ja...@carmanconsulting.com>.
Make sure your filter mapping for your other filter is after the
mapping for wicket filter.

On Mon, Mar 5, 2012 at 5:17 PM, Dan Retzlaff <dr...@gmail.com> wrote:
> If your ThreadLocal is needed within Wicket, shouldn't your filter run
> *before* WicketFilter?
>
> Does your filter use any Wicket classes that require something in
> o.a.w.ThreadContext?
>
> The basic design should work. We use a filter to manage a ThreadLocal
> Hibernate Session for open-session-in-view.
>
> On Mon, Mar 5, 2012 at 1:38 PM, YK <li...@yahoo.fr> wrote:
>
>> Hi,
>>
>> I'm trying to make example using wicket 1.5.4 and spring work but I keep
>> having this exception: org.apache.wicket.WicketRuntimeException: There is
>> no
>> application attached to current thread...
>>
>> My example defines also a servlet filter that is applied just after the
>> WicketFilter in web.xml.
>> This filter uses ThreadLocal to set/unset a variable around each
>> request/response cycle.
>>
>> I've noticed that if I disable the filter, my example works fine, but I
>> really need it to to pass a variable via the ThreadLocal: (static final
>> ThreadLocal<Map&lt;String, Serializable>> THREAD_OBJECT_CONTEXT = new
>> ThreadLocal<Map&lt;String, Serializable>>();)
>>
>>
>> Any idea about why wicket fails to accept such a filter please?
>>
>> Is there a workaround please?
>>
>>
>> Thanks
>>
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-WicketRuntimeException-There-is-no-application-attached-to-current-thread-tp4447781p4447781.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: org.apache.wicket.WicketRuntimeException: There is no application attached to current thread

Posted by Dan Retzlaff <dr...@gmail.com>.
If your ThreadLocal is needed within Wicket, shouldn't your filter run
*before* WicketFilter?

Does your filter use any Wicket classes that require something in
o.a.w.ThreadContext?

The basic design should work. We use a filter to manage a ThreadLocal
Hibernate Session for open-session-in-view.

On Mon, Mar 5, 2012 at 1:38 PM, YK <li...@yahoo.fr> wrote:

> Hi,
>
> I'm trying to make example using wicket 1.5.4 and spring work but I keep
> having this exception: org.apache.wicket.WicketRuntimeException: There is
> no
> application attached to current thread...
>
> My example defines also a servlet filter that is applied just after the
> WicketFilter in web.xml.
> This filter uses ThreadLocal to set/unset a variable around each
> request/response cycle.
>
> I've noticed that if I disable the filter, my example works fine, but I
> really need it to to pass a variable via the ThreadLocal: (static final
> ThreadLocal<Map&lt;String, Serializable>> THREAD_OBJECT_CONTEXT = new
> ThreadLocal<Map&lt;String, Serializable>>();)
>
>
> Any idea about why wicket fails to accept such a filter please?
>
> Is there a workaround please?
>
>
> Thanks
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-WicketRuntimeException-There-is-no-application-attached-to-current-thread-tp4447781p4447781.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>