Apache Tomee 7.0.0-M1不处理ServletRequestListener绑定?

时间:2016-01-14 10:16:38

标签: java spring servlets tomee-7

我目前正在使用 Apache Tomee 7.0.0-M1 版本运行应用程序。我正在使用 Spring 3.2.6 ,我想使用Spring管理的请求范围的服务bean。我已经阅读了文档,为此,我必须将这些添加到web.xml

<listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>

我注释了我的服务:

@Service
@Scope(value = org.springframework.web.context.WebApplicationContext.SCOPE_REQUEST)
@Transactional
public class RCService implements IRCService { ... }

问题是,我得到这样的例外:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xyz': 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:312)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
        at ...

this post中也提出了同样的问题,但正如我所说,我已经将必要的倾听者放在我的web.xml中。这是目前Tomee的问题/错误,还是我遗失了什么?

0 个答案:

没有答案