You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Douglas Ferguson <do...@douglasferguson.us> on 2010/06/03 10:07:58 UTC

Regression: @Inject'ed objects cannot be passed to Threads

I've posted a similar message the other week, because I was having strange behavior when passing objects that have been injected into my page to child threads.

So, we recently upgrade from 1.4.5 -> 1.4.7

Prior to the upgrade we had some runnables that would do some asynchronous work for us and we would just @inject the DAO into the page and pass that into constructor of the runnable.
This worked fine until the upgrade to 1.4.7. Now when the thread calls methods on the object we get the "org.apache.wicket.WicketRuntimeException: There is no application attached to current thread pool-13-thread-16' error

D/



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


Re: Regression: @Inject'ed objects cannot be passed to Threads

Posted by Douglas Ferguson <do...@douglasferguson.us>.
Also, I'm starting to dig into these and fix them and most of them make sense to me. They are obviously asynchronous threads that we start.

But this one has be a bit baffled. Does anybody recognize the classes in the stack? 

2010-06-04 00:06:34,623 ERROR [main] session.ManagerBase - Exception loading sessions from persistent storage
net.sf.cglib.core.CodeGenerationException: org.apache.wicket.WicketRuntimeException-->There is no application attached to current thread main
	at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:235)
	at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:220)
	at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:216)
	at net.sf.cglib.proxy.Enhancer.createUsingReflection(Enhancer.java:643)
	at net.sf.cglib.proxy.Enhancer.firstInstance(Enhancer.java:538)
	at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:225)
	at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
	at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
	at org.apache.wicket.proxy.LazyInitProxyFactory.createProxy(LazyInitProxyFactory.java:174)
	at org.apache.wicket.proxy.LazyInitProxyFactory$ProxyReplacement.readResolve(LazyInitProxyFactory.java:240)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at java.io.ObjectStreamClass.invokeReadResolve(Unknown Source)
	at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
	at java.io.ObjectInputStream.readObject0(Unknown Source)
	at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
	at java.io.ObjectInputStream.readSerialData(Unknown Source)
	at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
	at java.io.ObjectInputStream.readObject0(Unknown Source)
	at java.io.ObjectInputStream.readObject(Unknown Source)
	at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1402)
	at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:931)
	at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:394)
	at org.apache.catalina.session.StandardManager.load(StandardManager.java:321)
	at org.apache.catalina.session.StandardManager.start(StandardManager.java:637)
	at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:432)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4160)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
	at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:448)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.commons.daemon.support.DaemonLoader.start(DaemonLoader.java:177)
Caused by: org.apache.wicket.WicketRuntimeException: There is no application attached to current thread main
	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.data.dao.contacts.LinkPartnerDAO$$EnhancerByCGLIB$$8cfb2b7.newFulltextSearchBehavior(<generated>)
	at com.conducive.data.dao.contacts.GenericContactDAO.<init>(GenericContactDAO.java:73)
	at com.conducive.data.dao.contacts.LinkPartnerDAO.<init>(LinkPartnerDAO.java:41)
	at WICKET_com.conducive.data.dao.contacts.LinkPartnerDAO$$EnhancerByCGLIB$$8cfb2b7.<init>(<generated>)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:228)
	... 54 more



On Jun 3, 2010, at 10:22 AM, Igor Vaynberg wrote:

> this is not a regression in the sense that it is a bug. we have always
> maintained that the objects that get injected should only be used
> within wicket components.
> 
> you need to make sure the Application object is bound to the thread
> that is executing the runnable, so you will have to pass the
> application along with the dependencies and call application.set/unset
> around the runnable.
> 
> -igor
> 
> On Thu, Jun 3, 2010 at 1:07 AM, Douglas Ferguson
> <do...@douglasferguson.us> wrote:
>> I've posted a similar message the other week, because I was having strange behavior when passing objects that have been injected into my page to child threads.
>> 
>> So, we recently upgrade from 1.4.5 -> 1.4.7
>> 
>> Prior to the upgrade we had some runnables that would do some asynchronous work for us and we would just @inject the DAO into the page and pass that into constructor of the runnable.
>> This worked fine until the upgrade to 1.4.7. Now when the thread calls methods on the object we get the "org.apache.wicket.WicketRuntimeException: There is no application attached to current thread pool-13-thread-16' error
>> 
>> D/
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> 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
> 


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


Re: Regression: @Inject'ed objects cannot be passed to Threads

Posted by Douglas Ferguson <do...@douglasferguson.us>.
That makes sense. I was just surprised to see it stop working.

It is something people should be aware of when upgrading.

Any idea of what changed from 1.4.5 -> 1.4.7 that was have exacerbated this?

Also, what every happened to "wrap" idea that was proposed?

D/


On Jun 3, 2010, at 10:22 AM, Igor Vaynberg wrote:

> this is not a regression in the sense that it is a bug. we have always
> maintained that the objects that get injected should only be used
> within wicket components.
> 
> you need to make sure the Application object is bound to the thread
> that is executing the runnable, so you will have to pass the
> application along with the dependencies and call application.set/unset
> around the runnable.
> 
> -igor
> 
> On Thu, Jun 3, 2010 at 1:07 AM, Douglas Ferguson
> <do...@douglasferguson.us> wrote:
>> I've posted a similar message the other week, because I was having strange behavior when passing objects that have been injected into my page to child threads.
>> 
>> So, we recently upgrade from 1.4.5 -> 1.4.7
>> 
>> Prior to the upgrade we had some runnables that would do some asynchronous work for us and we would just @inject the DAO into the page and pass that into constructor of the runnable.
>> This worked fine until the upgrade to 1.4.7. Now when the thread calls methods on the object we get the "org.apache.wicket.WicketRuntimeException: There is no application attached to current thread pool-13-thread-16' error
>> 
>> D/
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> 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
> 


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


Re: Regression: @Inject'ed objects cannot be passed to Threads

Posted by Igor Vaynberg <ig...@gmail.com>.
this is not a regression in the sense that it is a bug. we have always
maintained that the objects that get injected should only be used
within wicket components.

you need to make sure the Application object is bound to the thread
that is executing the runnable, so you will have to pass the
application along with the dependencies and call application.set/unset
around the runnable.

-igor

On Thu, Jun 3, 2010 at 1:07 AM, Douglas Ferguson
<do...@douglasferguson.us> wrote:
> I've posted a similar message the other week, because I was having strange behavior when passing objects that have been injected into my page to child threads.
>
> So, we recently upgrade from 1.4.5 -> 1.4.7
>
> Prior to the upgrade we had some runnables that would do some asynchronous work for us and we would just @inject the DAO into the page and pass that into constructor of the runnable.
> This worked fine until the upgrade to 1.4.7. Now when the thread calls methods on the object we get the "org.apache.wicket.WicketRuntimeException: There is no application attached to current thread pool-13-thread-16' error
>
> D/
>
>
>
> ---------------------------------------------------------------------
> 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