cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yognhe <yan.yon...@gmail.com>
Subject Re: Does CXF support scope of Spring bean
Date Thu, 17 Dec 2009 15:55:47 GMT

Hi,

I created the bean like this:

	<bean id="currentMessage"
class="org.apache.cxf.phase.PhaseInterceptorChain"
		factory-method="getCurrentMessage" scope="request">
		<aop:scoped-proxy />
	</bean>

However, I got this exception:
Caused by: java.lang.IllegalStateException: No thread-bound request found:
Are you referring to request attributes outside of an actual web request, or
processing a request outside of the originally receiving thread? If you are
actually operating within a web request and still receive this message, your
code is probably running outside of DispatcherServlet/DispatcherPortlet: In
this case, use RequestContextListener or RequestContextFilter to expose the
current request.
	at
org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:121)
	at
org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:40)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)


Seems that it needs some configurations web.xml and I could not find it from
Spring doc. Could you please let know what the configuration I need or where
I can find it?

Thanks,


dkulp wrote:
> 
> 
> According to:
> http://old.nabble.com/Re:-Accessing-jax-rs-(CXF)-MessageContext-outside-service-class-(in-aspect)-in-Spring-(2.5)-p26030115.html
> 
> it works if you make it a scoped-proxy.
> 
> Dan
> 
> 
> On Tue December 15 2009 10:18:27 am Yognhe wrote:
>> Hi,
>> 
>> I tried to create a Spring bean in cxf.xml like this:
>> 
>> <bean id="cxfMessage" class="org.apache.cxf.phase.PhaseInterceptorChain"
>> factory-method="getCurrentMessage" scope="request"/>
>> 
>> And it does not work. I am wondering if CXF supports the scope of Spring
>> bean. If does, how should I configure CXF to create a Spring bean with a
>> scope.
>> 
>> Thanks,
>> Yonghe
>> 
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: http://old.nabble.com/Does-CXF-support-scope-of-Spring-bean-tp26795827p26830217.html
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message