cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Zav'yalov (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-5431) Spring Request scope is not available in OneWay WS method.
Date Tue, 03 Dec 2013 11:05:40 GMT

    [ https://issues.apache.org/jira/browse/CXF-5431?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13837582#comment-13837582
] 

Michael Zav'yalov commented on CXF-5431:
----------------------------------------

Yes, it works.
But the question is: Is there any guarantee that something else is never executed in the same
thread after WS request processing (xml parsing, connection, Spring context configuration,
so all) and before executing the WS implementation? So, it is not possible that request context
from another request is actually used here, is it?

And anyway, regular fix should be applied, I beleive.

> Spring Request scope is not available in OneWay WS method.
> ----------------------------------------------------------
>
>                 Key: CXF-5431
>                 URL: https://issues.apache.org/jira/browse/CXF-5431
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.7.8, 2.6.11
>            Reporter: Michael Zav'yalov
>         Attachments: testing-project.zip
>
>
> Have an asynchronous WEB operation (without any output of fault messages). This operation
is anotated as @OneWay in the generated code (WS interface).
> The WS is configurated as a Spring bean. The bean uses another Spring bean that is declared
with scope="request" and aop:scoped-proxy.
> When the WS operation is processed - calling the WS implementation is scheduled in a
background queue (WorkQueueManager ?). When it really executed - the following exception is
raised:
> [#|2013-12-02T13:02:23.201+0200|WARNING|glassfish3.1.2|org.apache.cxf.phase.PhaseInterceptorChain|_ThreadID=40;_ThreadName=Thread-2;|Application
{http://testing.cxf.apache.org/}OneWayWebServiceService#{http://testing.cxf.apache.org/}OneWayOperation
has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Error creating bean with name 'scopedTarget.requestScopeBean':
Scope 'request' is not active for the current thread; consider defining a scoped proxy for
this bean if you intend to refer to it from a singleton; nested exception is 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.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)
> 	at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:213)
> 	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)
> 	at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:178)
> 	at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:68)
> 	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75)
> 	at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
> 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> 	at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
> 	at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:107)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.resume(PhaseInterceptorChain.java:242)
> 	at org.apache.cxf.interceptor.OneWayProcessorInterceptor$1.run(OneWayProcessorInterceptor.java:144)
> 	at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:428)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
> 	at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:353)
> 	at java.lang.Thread.run(Thread.java:662)
> Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'scopedTarget.requestScopeBean': Scope 'request' is not active for the current thread;
consider defining a scoped proxy for this bean if you intend to refer to it from a singleton;
nested exception is 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.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:343)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
> 	at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:34)
> 	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.getTarget(CglibAopProxy.java:663)
> 	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:614)
> 	at org.apache.cxf.testing.RequestScopeBean$$EnhancerByCGLIB$$cd84f255.doSomething(<generated>)
> 	at org.apache.cxf.testing.OneWayWebService.oneWayOperation(OneWayWebService.java:23)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
> 	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
> 	... 17 more
> 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:131)
> 	at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:40)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:329)
> 	... 29 more
> |#]
> I can provide the simplest maven project to reproduce the problem.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message