Glen,

I haven't completely figured out a true solution to the problem, but I can 
point out a way to "fix" it.  

In your web.xml, you are setting up a spring ContextLoaderListener, but then 
pointing it at classpath:META-INF/cxf/cxf.xml.   That creates a very basic 
spring context with just a bus.   The CXF servlet will then create a child 
context to load the cxf-servlet.xml.    That then doesn't see the 
BeanPostProcessor's in the parent context. 

There are really two ways to "fix" this:

1) (best) - rename the cxf-servlet.xml to something like cxf-beans.xml and 
point the contextConfigLocation to that.   All the beans and such would be 
loaded into a single context which really is the preferred way to do it.

2) REMOVE the ContextLoaderListener from the web.xml for CXF.   The 
CXFServlet will create a single context from the cxf-servlet.xml which then 
will inject properly.    

The big issue is that the Bus is created in one context and then the 
Endpoint (and the DoubleItImpl) is created in another.   There is definitely 
an issue with that.    I'm going to see if there is anything we can do to 
work around it, but, IMO, your web.xml is a little "strange" for a CXF app.

Dan



On Tuesday, June 26, 2012 08:20:43 AM Glen Mazza wrote:
> Hi I recently updated my JAX-WS Handler tutorial
> (http://www.jroller.com/gmazza/entry/jaxws_handler_tutorial, source code
> https://github.com/gmazza/blog-samples/tree/master/jaxws_handler_tutorial)
> originally from April 2010.
> 
> It runs fine on Metro, mostly fine on CXF except for one problem: In the
> web service implementation
> (http://www.jroller.com/gmazza/entry/jaxws_handler_tutorial#hand6), the
> WebServiceContext variable is not getting populated in CXF as it is with
> Metro:
> 
>     @Resource
>     private  WebServiceContext  context;
> 
>      public  int  doubleIt(int  numberToDouble)  {
>        System.out.println("Context is"  +  ((context==  null)  ?  "null" 
> :  "not null")); return  numberToDouble*  2;
>     }
> 
> Metro returns "not null", while CXF returns "null".  The source code is
> the same, just the dependencies are switched between the two stacks.  Is
> there anything different I need to do (that I didn't need to do before)
> in order to get the CXF SEI to have a populated context value?
> 
> Thanks,
> Glen
-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to