I'm building a new CXF/JAX-RS/Spring app based on one that I built a few years 
ago, but with the latest versions of CXF and Spring (3.1.7 and 4.3.2, 
respectively).

I finally thought I had gotten my controller, service, and DAO all wired 
together, but then I noticed that when I got into the controller method after 
handling a web request, the service object was null, even though I saw the 
setter breakpoint being hit.  I then discovered that CXF appears to be creating 
a new instance of the controller for every request, and the controller instance 
that it uses isn't wired up.

I'm running this in TomEE 7.0.1.  The old app was running in WebLogic.

When I hit the breakpoint in the controller constructor after sending the 
request, I see the following stacktrace:

---------------
WebProjController.<init>() line: 44     
NativeConstructorAccessorImpl.newInstance0(Constructor<?>, Object[]) line: not 
available [native method]        
NativeConstructorAccessorImpl.newInstance(Object[]) line: not available 
DelegatingConstructorAccessorImpl.newInstance(Object[]) line: not available     
Constructor<T>.newInstance(Object...) line: not available       
CdiResourceProvider$DefaultBeanCreator.newInstance() line: 315  
CdiResourceProvider$DefaultBeanCreator.create() line: 321       
OpenEJBPerRequestPojoResourceProvider(CdiResourceProvider).getInstance(Message) 
line: 171       
CxfRsHttpListener.getServiceObject(Message) line: 1036  
CxfRsHttpListener.access$200(CxfRsHttpListener, Message) line: 142      
CxfRsHttpListener$4.getServiceObject(Message) line: 909 
CxfRsHttpListener$4(AbstractValidationInterceptor).handleMessage(Message) line: 
59      
PhaseInterceptorChain.doIntercept(Message) line: 308    
ChainInitiationObserver.onMessage(Message) line: 121    
---------------

Any idea how to make this use the existing Spring singleton instead of creating 
a new instance?

Reply via email to