Scope 'request' is not active for the current thread
Unable to instantiate Action, getUserAction, defined for 'getUser' in namespace '/'Error creating bean with name 'getUserAction': 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.
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:316)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:397)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:194)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:37)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:552)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99) 将request改为property,不知道为什么会这样 在网上看到有人这样回答
Scope 'request' is not active for the current thread这句话中说明在某个线程上试图调用scope为request的bean,但是这个bean中能被在http请求线程中实例化,
简单地说就是:在客户请求的时候才可以被实例化。而我的问题是在服务器启动的时候要实例化,所以有"Scope 'request' is not active for the current thread"
这一句的出现。在项目中如果有些bean实现了spring中的某些接口(如:SessionAware,RequestAware或BeanPostProcessor等等),就会在服务器启动的时候自动创建代理
(proxy),这时如果该bean的scope为request、session...这些web作用域的时候就会出现
consider defining a scoped proxy for this bean if you intend to refer to it from a singleton这句话。
我的'UserService'这个bean就是间接实现了BeanPostProcessor这个接口,所以一直抛出上面的异常。
Scope 'request' is not active for the current thread的更多相关文章
- Spring报错——Scope 'session' is not active for the current thread
在对程序进行了一些修改后,运行发现spring报了这个错误,这是由于我设置了一个@Scope("session")导致的,现记录下解决方法. 解决方法: 将Scope设置为scop ...
- scope='request'的bean预加载冲突
Error creating bean with name 'authenticationSuccessServlet': Scope 'request' is not active for the ...
- 【Spring】Spring IOC原理及源码解析之scope=request、session
一.容器 1. 容器 抛出一个议点:BeanFactory是IOC容器,而ApplicationContex则是Spring容器. 什么是容器?Collection和Container这两个单词都有存 ...
- spring 组件@Scope(request,session)示例
上回说到, spring组件的注解Scope大约有singleton.prototype.request.session.global session 这么几种常用的场景.这里需要特别说明一下,根据源 ...
- 【tensorflow基础】ubuntu-tensorflow可视化工具tensorboard-No dashboards are active for the current data set.
前言 今天基于tensorflow训练一个检测模型,本应看到训练曲线的,却只见到一个文件events.out.tfevents.1570520647.hostname,后来发现这个文件可以查看训练曲线 ...
- (最全)No dashboards are active for the current data set. 解决tensorboard无法启动和显示问题
按照网上的教程,我无法正常启动tensorboard,全过程没有报错,但是打开tensorboard显示No dashboards are active for the current data se ...
- org.hibernate.HibernateException: No Session found for current thread
spring.springmvc和hibernate整合 在sessionFactory.getCurrentSession()时,出现以下异常 No Session found for curren ...
- 关于spring3中No Session found for current thread!and Transaction的配置和管理(转)
今天我是特别的郁闷,本来项目做到一半,以前都好好的,结果下午就出现问题,苦逼的到现在才解决.它出现问题的时候都一声不坑, ,(天啦,现在才发现CSDN啥时候把QQ表情给整过来了)就在注册用户的时候,咦 ...
- Reporting Service 告警"w WARN: Thread pool pressure. Using current thread for a work item"
如果Reporting Service偶尔出现不可访问或访问出错情况,这种情况一般没有做监控的话,很难捕捉到.出现这种问题,最好检查Reporting Service的日志文件. 今天早上就遇到这样一 ...
随机推荐
- 1-win10配置 Vagrant 环境
1-win10配置 Vagrant 环境 2019.9.13 Vagrant 概述 vagrant是一个操作虚拟机的工具.是一个基于Ruby的工具,用于创建和部署虚拟化开发环境. 通过命令和配置文件来 ...
- IntelliJ IDEA 如何设置代码提示和代码模板
在编写java代码时如何设置不分大小写提示和设置快捷输出模板代码 首先设置不分大小写,settings-Editor-General-CodeCompletion 将红框的Match case取消打勾 ...
- 延长zencart1.5.x后台的15分钟登录时间和取消90天强制更换密码
延长zencart1.5.x后台的15分钟登录时间 打开includes\functions\sessions.php if (IS_ADMIN_FLAG === true) { if (!$SESS ...
- 实操 | 内存占用减少高达90%,还不用升级硬件?没错,这篇文章教你妙用Pandas轻松处理大规模数据
注:Pandas(Python Data Analysis Library) 是基于 NumPy 的一种工具,该工具是为了解决数据分析任务而创建的.此外,Pandas 纳入了大量库和一些标准的数据模型 ...
- Cordova热更新和App升级
web代码的更新此更新方式,只需要更新web前段代码,不需要更新android的原生代码.只是对js.html等的更新.1.添加插件 Cordova Hot Code Pushcordova plug ...
- vector引用参数
#include<iostream> #include<vector> using namespace std; //定义一个计算数字的函数,返回计算后的vector numb ...
- java——适配器模式、策略模式
适配器模式: https://www.cnblogs.com/honger/p/5970283.html 策略模式: https://www.jianshu.com/p/3bcf55cf83d3
- mysql的五大引擎跟优劣之分
MySQL有多种存储引擎,每种存储引擎有各自的优缺点,可以择优选择使用: MERGE.MEMORY(HEAP).EXAMPLE.ARCHIVE.CSV. · MEMORY存储引擎提供“内存中”表.ME ...
- 2018蓝桥杯C/C++组第4题第几个幸运数
题目4标题:第几个幸运数 到x星球旅行的游客都被发给一个整数,作为游客编号.x星的国王有个怪癖,他只喜欢数字3,5和7.国王规定,游客的编号如果只含有因子:3,5,7,就可以获得一份奖品. 我们来看前 ...
- TTTTTTTTTTTTTTTT #7 div1 A Breadth-First Search by Foxpower 在线LCA(倍增),模拟
A - Breadth-First Search by Foxpower Time Limit:2000MS Memory Limit:131072KB 64bit IO Format ...