Grails 错误:未找到线程绑定请求:您指的是请求属性吗...安装 Spring Security Core 后

发布于 2024-12-13 18:40:14 字数 836 浏览 5 评论 0原文


我刚刚创建了一个新的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

烟酉 2024-12-20 18:40:14

如果您使用 Maven,请确保您的 pom.xml:

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

和 BuildConfig,groovy: 中包含此内容:

runtime ":webxml:1.4.1"

这为我解决了 Grails 2.2.0 的问题。

If you're using Maven, make sure you have this on your pom.xml:

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

and in BuildConfig,groovy:

runtime ":webxml:1.4.1"

That solved the issue for me with Grails 2.2.0.

兔小萌 2024-12-20 18:40:14

如果您使用旧版本的 Spring Security Core,则可能会发生这种情况。我从 grails 1.3.7(和 spring security 1.1.3)升级到 grails 2.0.0 时遇到了这个问题。修复方法是在 application.properties 中更改为 spring-security-core 1.2:

plugins.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:

plugins.spring-security-core=1.2

More info at http://jira.grails.org/browse/GPSPRINGSECURITYCORE-98 as suggested by 황현정.

寒江雪… 2024-12-20 18:40:14

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

文件:web.xml

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

Try to register a RequestContextListener listener in web.xml file.

File : web.xml

<web-app>
   ...
   <listener>
    <listener-class>
        org.springframework.web.context.request.RequestContextListener
    </listener-class>
   </listener>
</web-app>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文