Grails 错误:未找到线程绑定请求:您指的是请求属性吗...安装 Spring Security Core 后
我刚刚创建了一个新的 grails-app,
一切都很好,直到我决定
安装 Spring Security Core。
安装 Spring Security Core 后
进行 s2-quickstart 并点击
grails run-app,它生成了
以下错误:
URI
/test1/
Class
java.lang.IllegalStateException
Message
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.
有人知道如何解决这个问题吗?
如果
我真的很感激 你帮忙。我尝试过寻找
然而其他网站上的答案
我无法解决它。 :)
顺便说一句,我正在使用:
Spring 安全核心 1.2.4
Grails 2.0.0.RC1
I just created a new grails-app,
everything was fine until I decided
to install Spring Security Core.
After installing Spring Security Core
doing an s2-quickstart and hitting
grails run-app, it produced the
following error:
URI
/test1/
Class
java.lang.IllegalStateException
Message
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.
Anybody know how to fix this?
I would really appreciate it if
you help. I have tried looking for
answers in other websites, however
I was unable to solve it. :)
BTW, I am using:
Spring Security Core 1.2.4
Grails 2.0.0.RC1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您使用 Maven,请确保您的 pom.xml:
和 BuildConfig,groovy: 中包含此内容:
这为我解决了 Grails 2.2.0 的问题。
If you're using Maven, make sure you have this on your pom.xml:
and in BuildConfig,groovy:
That solved the issue for me with Grails 2.2.0.
如果您使用旧版本的 Spring Security Core,则可能会发生这种情况。我从 grails 1.3.7(和 spring security 1.1.3)升级到 grails 2.0.0 时遇到了这个问题。修复方法是在 application.properties 中更改为 spring-security-core 1.2:
更多信息位于 http:// /jira.grails.org/browse/GPSPRINGSECURITYCORE-98 如 황현정 所建议。
This can happen if you're using an older version of Spring Security Core. I hit this when upgrading from grails 1.3.7 (and spring security 1.1.3) to grails 2.0.0. The fix was to change to spring-security-core 1.2 in application.properties:
More info at http://jira.grails.org/browse/GPSPRINGSECURITYCORE-98 as suggested by 황현정.
尝试在 web.xml 文件中注册 RequestContextListener 侦听器。
文件:web.xml
Try to register a RequestContextListener listener in web.xml file.
File : web.xml