Discussion:
Ajax and async task
Zbynek Vavros
2018-06-20 08:13:42 UTC
Permalink
Hi,

I've got an AjaxButton and hidden panel with progress bar and status
message which is hidden in the beggining.
My idea is to display the panel when the button is clicked and span long
task.
This task would update a counter that the progress will display using
AjaxSelfUpdatingTimerBehavior.

The problem is that the task has to be run in separate thread so the ajax
completes
and panel is even displayed before task end.

Got the idea from
https://stackoverflow.com/questions/15337198/wicket-calling-a-lengthy-operation-and-updating-through-ajax
.

But I'm getting org.apache.wicket.WicketRuntimeException: There is no
application attached to current thread Thread-XX.

Any suggestions?

Thanks,
Zbynek
Ernesto Reinaldo Barreiro
2018-06-20 08:44:55 UTC
Permalink
Maybe this can help

https://github.com/reiern70/antilia-bits/tree/master/bgprocess
Post by Zbynek Vavros
Hi,
I've got an AjaxButton and hidden panel with progress bar and status
message which is hidden in the beggining.
My idea is to display the panel when the button is clicked and span long
task.
This task would update a counter that the progress will display using
AjaxSelfUpdatingTimerBehavior.
The problem is that the task has to be run in separate thread so the ajax
completes
and panel is even displayed before task end.
Got the idea from
https://stackoverflow.com/questions/15337198/wicket-
calling-a-lengthy-operation-and-updating-through-ajax
.
But I'm getting org.apache.wicket.WicketRuntimeException: There is no
application attached to current thread Thread-XX.
Any suggestions?
Thanks,
Zbynek
--
Regards - Ernesto Reinaldo Barreiro
Zbynek Vavros
2018-06-20 09:05:43 UTC
Permalink
Still the same:

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

Zbynek



On Wed, Jun 20, 2018 at 10:44 AM, Ernesto Reinaldo Barreiro <
Post by Ernesto Reinaldo Barreiro
Maybe this can help
https://github.com/reiern70/antilia-bits/tree/master/bgprocess
Post by Zbynek Vavros
Hi,
I've got an AjaxButton and hidden panel with progress bar and status
message which is hidden in the beggining.
My idea is to display the panel when the button is clicked and span long
task.
This task would update a counter that the progress will display using
AjaxSelfUpdatingTimerBehavior.
The problem is that the task has to be run in separate thread so the ajax
completes
and panel is even displayed before task end.
Got the idea from
https://stackoverflow.com/questions/15337198/wicket-
calling-a-lengthy-operation-and-updating-through-ajax
.
But I'm getting org.apache.wicket.WicketRuntimeException: There is no
application attached to current thread Thread-XX.
Any suggestions?
Thanks,
Zbynek
--
Regards - Ernesto Reinaldo Barreiro
Maxim Solodovnik
2018-06-20 09:08:09 UTC
Permalink
You can use Applucation.get('THE_NAME_OF_YOUR_APP') it works in other
threads as well
Post by Zbynek Vavros
org.apache.wicket.WicketRuntimeException: There is no application attached
to current thread pool-XX-thread-XX
Zbynek
On Wed, Jun 20, 2018 at 10:44 AM, Ernesto Reinaldo Barreiro <
Post by Ernesto Reinaldo Barreiro
Maybe this can help
https://github.com/reiern70/antilia-bits/tree/master/bgprocess
Post by Zbynek Vavros
Hi,
I've got an AjaxButton and hidden panel with progress bar and status
message which is hidden in the beggining.
My idea is to display the panel when the button is clicked and span
long
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
task.
This task would update a counter that the progress will display using
AjaxSelfUpdatingTimerBehavior.
The problem is that the task has to be run in separate thread so the
ajax
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
completes
and panel is even displayed before task end.
Got the idea from
https://stackoverflow.com/questions/15337198/wicket-
calling-a-lengthy-operation-and-updating-through-ajax
.
But I'm getting org.apache.wicket.WicketRuntimeException: There is no
application attached to current thread Thread-XX.
Any suggestions?
Thanks,
Zbynek
--
Regards - Ernesto Reinaldo Barreiro
--
WBR
Maxim aka solomax
Ernesto Reinaldo Barreiro
2018-06-20 09:10:52 UTC
Permalink
Did you look at

https://github.com/reiern70/antilia-bits/tree/master/bgprocess
Post by Zbynek Vavros
org.apache.wicket.WicketRuntimeException: There is no application attached
to current thread pool-XX-thread-XX
Zbynek
On Wed, Jun 20, 2018 at 10:44 AM, Ernesto Reinaldo Barreiro <
Post by Ernesto Reinaldo Barreiro
Maybe this can help
https://github.com/reiern70/antilia-bits/tree/master/bgprocess
Post by Zbynek Vavros
Hi,
I've got an AjaxButton and hidden panel with progress bar and status
message which is hidden in the beggining.
My idea is to display the panel when the button is clicked and span
long
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
task.
This task would update a counter that the progress will display using
AjaxSelfUpdatingTimerBehavior.
The problem is that the task has to be run in separate thread so the
ajax
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
completes
and panel is even displayed before task end.
Got the idea from
https://stackoverflow.com/questions/15337198/wicket-
calling-a-lengthy-operation-and-updating-through-ajax
.
But I'm getting org.apache.wicket.WicketRuntimeException: There is no
application attached to current thread Thread-XX.
Any suggestions?
Thanks,
Zbynek
--
Regards - Ernesto Reinaldo Barreiro
--
Regards - Ernesto Reinaldo Barreiro
Ernesto Reinaldo Barreiro
2018-06-20 09:13:58 UTC
Permalink
https://github.com/reiern70/antilia-bits/blob/master/bgprocess/src/main/java/com/antilia/task/TasksRunnable.java#L28

On Wed, Jun 20, 2018 at 12:10 PM, Ernesto Reinaldo Barreiro <
Post by Ernesto Reinaldo Barreiro
Did you look at
https://github.com/reiern70/antilia-bits/tree/master/bgprocess
Post by Zbynek Vavros
org.apache.wicket.WicketRuntimeException: There is no application attached
to current thread pool-XX-thread-XX
Zbynek
On Wed, Jun 20, 2018 at 10:44 AM, Ernesto Reinaldo Barreiro <
Post by Ernesto Reinaldo Barreiro
Maybe this can help
https://github.com/reiern70/antilia-bits/tree/master/bgprocess
Post by Zbynek Vavros
Hi,
I've got an AjaxButton and hidden panel with progress bar and status
message which is hidden in the beggining.
My idea is to display the panel when the button is clicked and span
long
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
task.
This task would update a counter that the progress will display using
AjaxSelfUpdatingTimerBehavior.
The problem is that the task has to be run in separate thread so the
ajax
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
completes
and panel is even displayed before task end.
Got the idea from
https://stackoverflow.com/questions/15337198/wicket-
calling-a-lengthy-operation-and-updating-through-ajax
.
But I'm getting org.apache.wicket.WicketRuntimeException: There is no
application attached to current thread Thread-XX.
Any suggestions?
Thanks,
Zbynek
--
Regards - Ernesto Reinaldo Barreiro
--
Regards - Ernesto Reinaldo Barreiro
--
Regards - Ernesto Reinaldo Barreiro
Zbynek Vavros
2018-06-20 21:39:53 UTC
Permalink
Hi Ernesto,

sorry I was away in the afternoon/evening.
Passing application into runnable constructor is working for me!

Many thanks

On Wed, Jun 20, 2018 at 11:13 AM, Ernesto Reinaldo Barreiro <
Post by Ernesto Reinaldo Barreiro
https://github.com/reiern70/antilia-bits/blob/master/
bgprocess/src/main/java/com/antilia/task/TasksRunnable.java#L28
On Wed, Jun 20, 2018 at 12:10 PM, Ernesto Reinaldo Barreiro <
Post by Ernesto Reinaldo Barreiro
Did you look at
https://github.com/reiern70/antilia-bits/tree/master/bgprocess
Post by Zbynek Vavros
org.apache.wicket.WicketRuntimeException: There is no application attached
to current thread pool-XX-thread-XX
Zbynek
On Wed, Jun 20, 2018 at 10:44 AM, Ernesto Reinaldo Barreiro <
Post by Ernesto Reinaldo Barreiro
Maybe this can help
https://github.com/reiern70/antilia-bits/tree/master/bgprocess
On Wed, Jun 20, 2018 at 11:13 AM, Zbynek Vavros <
Post by Zbynek Vavros
Hi,
I've got an AjaxButton and hidden panel with progress bar and status
message which is hidden in the beggining.
My idea is to display the panel when the button is clicked and span
long
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
task.
This task would update a counter that the progress will display
using
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
AjaxSelfUpdatingTimerBehavior.
The problem is that the task has to be run in separate thread so the
ajax
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
completes
and panel is even displayed before task end.
Got the idea from
https://stackoverflow.com/questions/15337198/wicket-
calling-a-lengthy-operation-and-updating-through-ajax
.
But I'm getting org.apache.wicket.WicketRuntimeException: There is
no
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
application attached to current thread Thread-XX.
Any suggestions?
Thanks,
Zbynek
--
Regards - Ernesto Reinaldo Barreiro
--
Regards - Ernesto Reinaldo Barreiro
--
Regards - Ernesto Reinaldo Barreiro
Ernesto Reinaldo Barreiro
2018-06-21 07:04:10 UTC
Permalink
Glad to be of help ;-)
Post by Zbynek Vavros
Hi Ernesto,
sorry I was away in the afternoon/evening.
Passing application into runnable constructor is working for me!
Many thanks
On Wed, Jun 20, 2018 at 11:13 AM, Ernesto Reinaldo Barreiro <
Post by Ernesto Reinaldo Barreiro
https://github.com/reiern70/antilia-bits/blob/master/
bgprocess/src/main/java/com/antilia/task/TasksRunnable.java#L28
On Wed, Jun 20, 2018 at 12:10 PM, Ernesto Reinaldo Barreiro <
Post by Ernesto Reinaldo Barreiro
Did you look at
https://github.com/reiern70/antilia-bits/tree/master/bgprocess
On Wed, Jun 20, 2018 at 12:05 PM, Zbynek Vavros <
Post by Zbynek Vavros
org.apache.wicket.WicketRuntimeException: There is no application attached
to current thread pool-XX-thread-XX
Zbynek
On Wed, Jun 20, 2018 at 10:44 AM, Ernesto Reinaldo Barreiro <
Post by Ernesto Reinaldo Barreiro
Maybe this can help
https://github.com/reiern70/antilia-bits/tree/master/bgprocess
On Wed, Jun 20, 2018 at 11:13 AM, Zbynek Vavros <
Post by Zbynek Vavros
Hi,
I've got an AjaxButton and hidden panel with progress bar and
status
Post by Ernesto Reinaldo Barreiro
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
message which is hidden in the beggining.
My idea is to display the panel when the button is clicked and
span
Post by Ernesto Reinaldo Barreiro
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
long
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
task.
This task would update a counter that the progress will display
using
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
AjaxSelfUpdatingTimerBehavior.
The problem is that the task has to be run in separate thread so
the
Post by Ernesto Reinaldo Barreiro
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
ajax
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
completes
and panel is even displayed before task end.
Got the idea from
https://stackoverflow.com/questions/15337198/wicket-
calling-a-lengthy-operation-and-updating-through-ajax
.
But I'm getting org.apache.wicket.WicketRuntimeException: There
is
Post by Ernesto Reinaldo Barreiro
no
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
application attached to current thread Thread-XX.
Any suggestions?
Thanks,
Zbynek
--
Regards - Ernesto Reinaldo Barreiro
--
Regards - Ernesto Reinaldo Barreiro
--
Regards - Ernesto Reinaldo Barreiro
--
Regards - Ernesto Reinaldo Barreiro
Zbynek Vavros
2018-06-20 09:21:42 UTC
Permalink
Yeah the difference (from what I see) is that ThreadPoolExecutor is used in
BgProcessApplication.
And usage of
https://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/Session.html#bind()
that is non-related.
None of that helps me...

@Maxim: Not sure what you mean but ThreadContext.getApplication() returns
my application
without the need to do anything

Zbynek

On Wed, Jun 20, 2018 at 11:10 AM, Ernesto Reinaldo Barreiro <
Post by Ernesto Reinaldo Barreiro
Did you look at
https://github.com/reiern70/antilia-bits/tree/master/bgprocess
Post by Zbynek Vavros
org.apache.wicket.WicketRuntimeException: There is no application
attached
Post by Zbynek Vavros
to current thread pool-XX-thread-XX
Zbynek
On Wed, Jun 20, 2018 at 10:44 AM, Ernesto Reinaldo Barreiro <
Post by Ernesto Reinaldo Barreiro
Maybe this can help
https://github.com/reiern70/antilia-bits/tree/master/bgprocess
On Wed, Jun 20, 2018 at 11:13 AM, Zbynek Vavros <
Post by Zbynek Vavros
Hi,
I've got an AjaxButton and hidden panel with progress bar and status
message which is hidden in the beggining.
My idea is to display the panel when the button is clicked and span
long
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
task.
This task would update a counter that the progress will display using
AjaxSelfUpdatingTimerBehavior.
The problem is that the task has to be run in separate thread so the
ajax
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
completes
and panel is even displayed before task end.
Got the idea from
https://stackoverflow.com/questions/15337198/wicket-
calling-a-lengthy-operation-and-updating-through-ajax
.
But I'm getting org.apache.wicket.WicketRuntimeException: There is
no
Post by Zbynek Vavros
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
application attached to current thread Thread-XX.
Any suggestions?
Thanks,
Zbynek
--
Regards - Ernesto Reinaldo Barreiro
--
Regards - Ernesto Reinaldo Barreiro
Maxim Solodovnik
2018-06-20 09:30:15 UTC
Permalink
"There is no application attached to current thread" error is usually mean
Application.get() is not working ....
Post by Zbynek Vavros
Yeah the difference (from what I see) is that ThreadPoolExecutor is used in
BgProcessApplication.
And usage of
https://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/Session.html#bind()
that is non-related.
None of that helps me...
@Maxim: Not sure what you mean but ThreadContext.getApplication() returns
my application
without the need to do anything
Zbynek
On Wed, Jun 20, 2018 at 11:10 AM, Ernesto Reinaldo Barreiro <
Post by Ernesto Reinaldo Barreiro
Did you look at
https://github.com/reiern70/antilia-bits/tree/master/bgprocess
Post by Zbynek Vavros
org.apache.wicket.WicketRuntimeException: There is no application
attached
Post by Zbynek Vavros
to current thread pool-XX-thread-XX
Zbynek
On Wed, Jun 20, 2018 at 10:44 AM, Ernesto Reinaldo Barreiro <
Post by Ernesto Reinaldo Barreiro
Maybe this can help
https://github.com/reiern70/antilia-bits/tree/master/bgprocess
On Wed, Jun 20, 2018 at 11:13 AM, Zbynek Vavros <
Post by Zbynek Vavros
Hi,
I've got an AjaxButton and hidden panel with progress bar and
status
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
message which is hidden in the beggining.
My idea is to display the panel when the button is clicked and span
long
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
task.
This task would update a counter that the progress will display
using
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
AjaxSelfUpdatingTimerBehavior.
The problem is that the task has to be run in separate thread so
the
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
ajax
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
completes
and panel is even displayed before task end.
Got the idea from
https://stackoverflow.com/questions/15337198/wicket-
calling-a-lengthy-operation-and-updating-through-ajax
.
But I'm getting org.apache.wicket.WicketRuntimeException: There is
no
Post by Zbynek Vavros
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
application attached to current thread Thread-XX.
Any suggestions?
Thanks,
Zbynek
--
Regards - Ernesto Reinaldo Barreiro
--
Regards - Ernesto Reinaldo Barreiro
--
WBR
Maxim aka solomax
Zbynek Vavros
2018-06-20 09:35:44 UTC
Permalink
Works just fine for me here.
Seems this may be related to using Google Guice:

org.apache.wicket.WicketRuntimeException: There is no application attached
to current thread Thread-68
at org.apache.wicket.Application.get(Application.java:236)
at
org.apache.wicket.guice.GuiceProxyTargetLocator.getInjector(GuiceProxyTargetLocator.java:135)
at
org.apache.wicket.guice.GuiceProxyTargetLocator.locateProxyTarget(GuiceProxyTargetLocator.java:60)
at
org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:498)

Zbynek
Post by Maxim Solodovnik
"There is no application attached to current thread" error is usually mean
Application.get() is not working ....
Post by Zbynek Vavros
Yeah the difference (from what I see) is that ThreadPoolExecutor is used
in
Post by Zbynek Vavros
BgProcessApplication.
And usage of
https://ci.apache.org/projects/wicket/apidocs/6.x/
org/apache/wicket/Session.html#bind()
Post by Zbynek Vavros
that is non-related.
None of that helps me...
@Maxim: Not sure what you mean but ThreadContext.getApplication() returns
my application
without the need to do anything
Zbynek
On Wed, Jun 20, 2018 at 11:10 AM, Ernesto Reinaldo Barreiro <
Post by Ernesto Reinaldo Barreiro
Did you look at
https://github.com/reiern70/antilia-bits/tree/master/bgprocess
On Wed, Jun 20, 2018 at 12:05 PM, Zbynek Vavros <
Post by Zbynek Vavros
org.apache.wicket.WicketRuntimeException: There is no application
attached
Post by Zbynek Vavros
to current thread pool-XX-thread-XX
Zbynek
On Wed, Jun 20, 2018 at 10:44 AM, Ernesto Reinaldo Barreiro <
Post by Ernesto Reinaldo Barreiro
Maybe this can help
https://github.com/reiern70/antilia-bits/tree/master/bgprocess
On Wed, Jun 20, 2018 at 11:13 AM, Zbynek Vavros <
Post by Zbynek Vavros
Hi,
I've got an AjaxButton and hidden panel with progress bar and
status
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
message which is hidden in the beggining.
My idea is to display the panel when the button is clicked and
span
Post by Zbynek Vavros
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
long
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
task.
This task would update a counter that the progress will display
using
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
AjaxSelfUpdatingTimerBehavior.
The problem is that the task has to be run in separate thread so
the
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
ajax
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
completes
and panel is even displayed before task end.
Got the idea from
https://stackoverflow.com/questions/15337198/wicket-
calling-a-lengthy-operation-and-updating-through-ajax
.
But I'm getting org.apache.wicket.WicketRuntimeException: There
is
Post by Zbynek Vavros
Post by Ernesto Reinaldo Barreiro
no
Post by Zbynek Vavros
Post by Ernesto Reinaldo Barreiro
Post by Zbynek Vavros
application attached to current thread Thread-XX.
Any suggestions?
Thanks,
Zbynek
--
Regards - Ernesto Reinaldo Barreiro
--
Regards - Ernesto Reinaldo Barreiro
--
WBR
Maxim aka solomax
Sebastien Briquet
2018-06-20 08:47:01 UTC
Permalink
Hi Zbynek,

Some times ago I did a quickstart for async calls with Websocket
notification.
Not exactly your use-case but it can give you some ideas...

https://github.com/sebfz1/wicket-quickstart-cdi-async

Best regards,
Sebastien
Loading...