Grails错误:未找到线程绑定请求:您是否引用请求属性。。。安装Spring安全内核后

Grails错误:未找到线程绑定请求:您是否引用请求属性。。。安装Spring安全内核后,grails,spring-security,illegalstateexception,Grails,Spring Security,Illegalstateexception,我刚刚创建了一个新的grails应用程序, 在我决定之前一切都很好 安装Spring安全内核 安装Spring安全内核后 执行s2快速启动并点击 grails run应用程序,它生成了 以下错误: URI /test1/ Class java.lang.IllegalStateException Message No thread-bound request found: Are you referring to request attributes outside of an actual w


我刚刚创建了一个新的grails应用程序,
在我决定之前一切都很好
安装Spring安全内核

安装Spring安全内核后
执行s2快速启动并点击
grails run应用程序,它生成了
以下错误:

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 Security Core 1.2.4

Grails2.0.0.RC1

如果您使用的是较旧版本的Spring Security Core,则可能会发生这种情况。我在从Grails1.3.7(和SpringSecurity1.1.3)升级到Grails2.0.0时遇到了这个问题。修复程序将在application.properties中更改为spring security core 1.2:

plugins.spring-security-core=1.2

更多信息,请访问황현정.

如果您使用的是Maven,请确保在pom.xml上有:

<dependency>
    <groupId>org.grails.plugins</groupId>
    <artifactId>webxml</artifactId>
    <version>1.4.1</version>
    <scope>runtime</scope>
    <type>zip</type>
</dependency>

这为我解决了Grails2.2.0的问题。

尝试在web.xml文件中注册RequestContextListener侦听器

文件:web.xml

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

...
org.springframework.web.context.request.RequestContextListener

URI/test1/hit使用什么控制器?它正在采取什么行动?您可以从控制器发布的任何代码都会有所帮助,因为它可能是控制器中的某个代码或不在事务会话中的某个服务。您好,我刚刚构建了我所有的控制器,除了Spring Security Core本身生成的控制器/test1/是我的应用程序的名称。:)我只是尝试创建一个项目,添加一个域类,在该域上生成所有内容,安装SpringSecurityCore,运行s2快速启动,效果很好。你试过grails clean吗?是的。。。Grails clean实际上是我做的第一件事,但没有运气。。我应你的要求又试了一次,但还是一样。。隐马尔可夫模型。。一定是哪里出了什么问题,我所有的其他应用程序都运行得很顺利。对不起,我对servlet和其他东西不是很熟悉(我还没能解决这个问题..但是看看grails.jira…似乎有些人和我有同样的问题..很好,工作得很有魅力,但是grails告诉我运行这个命令的
s2 quickstart
消息是什么呢?这在grails 2.2.3,spring security core 1.2.7.3中为我解决了这个问题,谢谢!!修改BuildConfig.groovy对我不起作用,但向应用程序添加“plugins.webxml=1.4.1”。属性解决了这个问题。(我使用的是ggts)
<web-app>
   ...
   <listener>
    <listener-class>
        org.springframework.web.context.request.RequestContextListener
    </listener-class>
   </listener>
</web-app>