I found this:

http://pastebin.com/NN58fiZx

But I don't see anything that would tied the Application to the child thread.

It is just a button that would exec a thread for you.

D/

On May 28, 2010, at 1:06 PM, Douglas Ferguson wrote:

> I've been following the thread to some degree, but I missed that.
> 
> Is there a code example somewhere?
> 
> D/
> 
> On May 28, 2010, at 11:34 AM, James Carman wrote:
> 
>> Perhaps you would be interested in the other threads that have been
>> going on where we discuss InheritableThreadLocal.  In there Jeremy
>> gave a good solution that would fix what you're seeing.  Basically,
>> you use the beforeExecute()/afterExecute() methods to set/clear the
>> Application's ThreadLocal variable so that it's available during the
>> execution of the task.
>> 
>> On Fri, May 28, 2010 at 12:01 PM, Douglas Ferguson
>> <doug...@douglasferguson.us> wrote:
>>> I'm still spinning my wheels on this one.
>>> 
>>> Let me try to explain better..
>>> 
>>> On the page I have
>>> 
>>> @Inject DAOFactory
>>> @Inject MyService
>>> 
>>> On the DAOFactory I have
>>> 
>>> @Inject DAO1
>>> @Inject DAO2
>>> etc...
>>> 
>>> On MyService I have
>>> 
>>> @Inject DAO1
>>> 
>>> In my module I have
>>> 
>>> bind(MyService.class).toInstance(new MyService());
>>> bind(IDAOFactory.class).to(DAOFactory.class).in(Singleton.class);
>>> bind(DAO1.class).in(Singleton.class);
>>> bind(DAO2.class).in(Singleton.class);
>>> 
>>> On the page I also have:
>>> 
>>> genericWorkPool.submit(new Runnable() {
>>> 
>>> @Override
>>> public void run() {
>>> try {
>>> //Do stuff with DAOFactory -- works
>>>                      //Do stuff with MyService -- Blow ups <<<---- See 
>>> exception below
>>> } catch (Throwable t) {
>>> log.error("Error sending email on Signup: " + t.getMessage(), t);
>>> }
>>> }
>>> }
>>> 
>>> This is the error I get
>>> 
>>> org.apache.wicket.WicketRuntimeException: There is no application attached 
>>> to current thread pool-13-thread-3
>>> at org.apache.wicket.Application.get(Application.java:179)
>>> at 
>>> org.apache.wicket.guice.GuiceProxyTargetLocator.locateProxyTarget(GuiceProxyTargetLocator.java:73)
>>> at 
>>> org.apache.wicket.proxy.LazyInitProxyFactory$CGLibInterceptor.intercept(LazyInitProxyFactory.java:317)
>>> at 
>>> WICKET_com.conducive.logic.buzzbox.BuzzboxEmailGenerator$$EnhancerByCGLIB$$1171cfab.generateFor(<generated>)
>>>   <-- this is "MyService"
>>> 
>>> I can't understand why DAOFactory would work ok but MyService wouldn't.
>>> 
>>> 
>>> On May 27, 2010, at 6:53 PM, Douglas Ferguson wrote:
>>> 
>>> I'm using 1.4.8 (not the ITL version).
>>> 
>>> I have pass a runnable to an executer, how can I make use of classes that 
>>> use @Inject?
>>> 
>>> When I try to do so, it blows up saying "There is no application attached 
>>> to current thread pool-13-thread-1"
>>> 
>>> The confusing thing is that I inject 2 DAOs and 1 service. The 2DAOs work 
>>> just fine but the service blows up.
>>> 
>>> I've tried these combinations:
>>> 
>>> 1) @Inject into the page and then pass the reference to the constructor of 
>>> the runnable
>>> 2) Construct the service in the Runnable and call 
>>> @InjectorHolder.getInjector().inject(service)
>>> 
>>> Neither works.
>>> 
>>> D/
>>> 
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


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

Reply via email to