我正在从事一个遗留项目,使用stripes框架构建。它使用的是spring框架。
下面是applicationcontext.xml
.....
<bean id="hospitalSessionBean" class="com.fapl.service.base.HospitalSeesionBean" scope="session">
<aop:scoped-proxy/>
</bean>
.....
下面是bean类
public class HospitalSeesionBean implements Serializable {
public HospitalSeesionBean() {
super();
}
//properties and their getters/setters
}
然后我使用下面的豆子
公共类baseaction实现actionbean{
@SpringBean
public HospitalSeesionBean hospitalSessionBean;
public HospitalSeesionBean getHospitalSessionBean() {
return hospitalSessionBean;
}
public void setHospitalSessionBean(HospitalSeesionBean hospitalSessionBean) {
this.hospitalSessionBean = hospitalSessionBean;
}
.........
}
当我使用这个,我得到下面的错误,而试图访问
BaseAction org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.hospitalSessionBean': Scope 'session' 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.
这个bean作为会话bean工作是很重要的。有人能建议如何做到这一点吗
服务器为jboss eap 6.1,java版本为8,stripes版本为1.5.6,spring版本为4.3.10
暂无答案!
目前还没有任何答案,快来回答吧!