Couple possible ways to handle it:
1) Add an import for "META-INF/cxf/cxf-extension-jaxws.xml"
That registers an additional injector for injecting the WebServiceContext into
spring beans prior to them being proxied. That works MOST of the time, but
not all.
2) Don't @Resource it and just do:
WebServiceContext ctx
= new org.apache.cxf.jaxws.context.WebServiceContextImpl();
That's all that would be occuring when injected anyway.
3) In your method calls that need it, you can just do:
ctx = new org.apache.cxf.jaxws.context.WebServiceContextImpl();
as well. Basically, the WebServiceContextImpl just wrappers a thread local.
Dan
On Thu August 13 2009 4:59:12 am Nicola D'Elia wrote:
> Hi to everyone,
> i have a problem injecting the web-service-context into a spring bean
> exposed as a web service through cxf.
>
> If the bean is a pojo everything works.
>
> When i enable Spring AOP, the bean becomes an AOP proxy and the resource
> does not get injected (is null).
>
> I tryed with JDK Dynamic Proxy and the ResourceInjector throws exception in
> tests (both with field and setter injection).
>
> I switched to CGLIB proxy and everything works fine in tests, but when
> deployed in Jboss/Tomcat the context is null, no exception thrown.
>
>
> Are there known issues and patch/warkaround about the problem ?
>
> Or is there a way to get the web-service-context programmatically ?
>
>
> Thank you very much, any help appreciated.
>
>
> Nicola
--
Daniel Kulp
[email protected]
http://www.dankulp.com/blog