You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by jsinai <js...@yahoo.com> on 2011/04/07 20:28:09 UTC

SpringComponentInjector and non-Wicket servlets

We are seeing an intermittent problem with our webapp, where we are seeing
the exception below. We have servlets other than Wicket's in our webapp,
which provide remote services. The problem seems to be that somehow the
Wicket proxy for a given Spring bean is being requested, perhaps from a
different thread than Wicket's. Is there a solution for this?

Any advice is appreciated.

Julian

org.apache.wicket.WicketRuntimeException: There is no application attached
to
current thread http-8443-1
        at org.apache.wicket.Application.get(Application.java:179)
        at
org.apache.wicket.spring.injection.annot.SpringComponentInjector$ContextLocator.getSpringContext(SpringComponentInjector.java:159)
        at
org.apache.wicket.spring.SpringBeanLocator.getSpringContext(SpringBeanLocator.java:219)
        at
org.apache.wicket.spring.SpringBeanLocator.locateProxyTarget(SpringBeanLocator.java:205)
        at
org.apache.wicket.proxy.LazyInitProxyFactory$CGLibInterceptor.intercept(LazyInitProxyFactory.java:317)
        at
WICKET_com.hytrust.arc.TrustedHostMgr$$EnhancerByCGLIB$$60187c65.refreshAllPolicy()
        at
com.hytrust.policy.update.DynamicUpdater.dynamicRefreshHost(DynamicUpdater.java:868)


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/SpringComponentInjector-and-non-Wicket-servlets-tp3434182p3434182.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: SpringComponentInjector and non-Wicket servlets

Posted by Martin Grigorov <mg...@apache.org>.
Or use WicketSessionFilter to export the Application and Session to other
servlets
Hacky but ...

On Thu, Apr 7, 2011 at 9:41 PM, Igor Vaynberg <ig...@gmail.com>wrote:

> the proxies wicket generates are only to be used by wicket, so do not
> pass those to other services.
>
> -igor
>
>
> On Thu, Apr 7, 2011 at 11:28 AM, jsinai <js...@yahoo.com> wrote:
> > We are seeing an intermittent problem with our webapp, where we are
> seeing
> > the exception below. We have servlets other than Wicket's in our webapp,
> > which provide remote services. The problem seems to be that somehow the
> > Wicket proxy for a given Spring bean is being requested, perhaps from a
> > different thread than Wicket's. Is there a solution for this?
> >
> > Any advice is appreciated.
> >
> > Julian
> >
> > org.apache.wicket.WicketRuntimeException: There is no application
> attached
> > to
> > current thread http-8443-1
> >        at org.apache.wicket.Application.get(Application.java:179)
> >        at
> >
> org.apache.wicket.spring.injection.annot.SpringComponentInjector$ContextLocator.getSpringContext(SpringComponentInjector.java:159)
> >        at
> >
> org.apache.wicket.spring.SpringBeanLocator.getSpringContext(SpringBeanLocator.java:219)
> >        at
> >
> org.apache.wicket.spring.SpringBeanLocator.locateProxyTarget(SpringBeanLocator.java:205)
> >        at
> >
> org.apache.wicket.proxy.LazyInitProxyFactory$CGLibInterceptor.intercept(LazyInitProxyFactory.java:317)
> >        at
> >
> WICKET_com.hytrust.arc.TrustedHostMgr$$EnhancerByCGLIB$$60187c65.refreshAllPolicy()
> >        at
> >
> com.hytrust.policy.update.DynamicUpdater.dynamicRefreshHost(DynamicUpdater.java:868)
> >
> >
> > --
> > View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/SpringComponentInjector-and-non-Wicket-servlets-tp3434182p3434182.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 <http://jweekend.com/>

Re: SpringComponentInjector and non-Wicket servlets

Posted by Igor Vaynberg <ig...@gmail.com>.
well, looks like com.hytrust.policy.update.DynamicUpdater is using a
proxy, is that a wicket class?

-igor

On Thu, Apr 7, 2011 at 1:48 PM, jsinai <js...@yahoo.com> wrote:
> Igor, thanks for your reply. But that's the weird thing: we are not passing
> those proxies to other services. We use the @SpringBean annotation only in
> the UI code.
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/SpringComponentInjector-and-non-Wicket-servlets-tp3434182p3434532.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: SpringComponentInjector and non-Wicket servlets

Posted by jsinai <js...@yahoo.com>.
Igor, thanks for your reply. But that's the weird thing: we are not passing
those proxies to other services. We use the @SpringBean annotation only in
the UI code.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/SpringComponentInjector-and-non-Wicket-servlets-tp3434182p3434532.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: SpringComponentInjector and non-Wicket servlets

Posted by Igor Vaynberg <ig...@gmail.com>.
the proxies wicket generates are only to be used by wicket, so do not
pass those to other services.

-igor


On Thu, Apr 7, 2011 at 11:28 AM, jsinai <js...@yahoo.com> wrote:
> We are seeing an intermittent problem with our webapp, where we are seeing
> the exception below. We have servlets other than Wicket's in our webapp,
> which provide remote services. The problem seems to be that somehow the
> Wicket proxy for a given Spring bean is being requested, perhaps from a
> different thread than Wicket's. Is there a solution for this?
>
> Any advice is appreciated.
>
> Julian
>
> org.apache.wicket.WicketRuntimeException: There is no application attached
> to
> current thread http-8443-1
>        at org.apache.wicket.Application.get(Application.java:179)
>        at
> org.apache.wicket.spring.injection.annot.SpringComponentInjector$ContextLocator.getSpringContext(SpringComponentInjector.java:159)
>        at
> org.apache.wicket.spring.SpringBeanLocator.getSpringContext(SpringBeanLocator.java:219)
>        at
> org.apache.wicket.spring.SpringBeanLocator.locateProxyTarget(SpringBeanLocator.java:205)
>        at
> org.apache.wicket.proxy.LazyInitProxyFactory$CGLibInterceptor.intercept(LazyInitProxyFactory.java:317)
>        at
> WICKET_com.hytrust.arc.TrustedHostMgr$$EnhancerByCGLIB$$60187c65.refreshAllPolicy()
>        at
> com.hytrust.policy.update.DynamicUpdater.dynamicRefreshHost(DynamicUpdater.java:868)
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/SpringComponentInjector-and-non-Wicket-servlets-tp3434182p3434182.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: SpringComponentInjector and non-Wicket servlets

Posted by jsinai <js...@yahoo.com>.
Thanks to Vineet and Igor for your help. I think I have an idea about what
we've been doing wrong.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/SpringComponentInjector-and-non-Wicket-servlets-tp3434182p3434738.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: SpringComponentInjector and non-Wicket servlets

Posted by vineet semwal <vi...@gmail.com>.
say you are using @springbean in a  non component in a wicket thread
and you are using it in a non wicket thread too,
you can do something like below

  if(Application.exists())
            {
          InjectorHolder.getInjector().inject(this);
            }else{
//set service my way
service=ServicesFactory.getService();
}

On Thu, Apr 7, 2011 at 11:58 PM, jsinai <js...@yahoo.com> wrote:
> We are seeing an intermittent problem with our webapp, where we are seeing
> the exception below. We have servlets other than Wicket's in our webapp,
> which provide remote services. The problem seems to be that somehow the
> Wicket proxy for a given Spring bean is being requested, perhaps from a
> different thread than Wicket's. Is there a solution for this?
>
> Any advice is appreciated.
>
> Julian
>
> org.apache.wicket.WicketRuntimeException: There is no application attached
> to
> current thread http-8443-1
>        at org.apache.wicket.Application.get(Application.java:179)
>        at
> org.apache.wicket.spring.injection.annot.SpringComponentInjector$ContextLocator.getSpringContext(SpringComponentInjector.java:159)
>        at
> org.apache.wicket.spring.SpringBeanLocator.getSpringContext(SpringBeanLocator.java:219)
>        at
> org.apache.wicket.spring.SpringBeanLocator.locateProxyTarget(SpringBeanLocator.java:205)
>        at
> org.apache.wicket.proxy.LazyInitProxyFactory$CGLibInterceptor.intercept(LazyInitProxyFactory.java:317)
>        at
> WICKET_com.hytrust.arc.TrustedHostMgr$$EnhancerByCGLIB$$60187c65.refreshAllPolicy()
>        at
> com.hytrust.policy.update.DynamicUpdater.dynamicRefreshHost(DynamicUpdater.java:868)
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/SpringComponentInjector-and-non-Wicket-servlets-tp3434182p3434182.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
>
>



-- 
thank you,

regards,
Vineet Semwal

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