Grails没有线程绑定请求发现错误?



根据spring安全和saml插件教程,我创建了一个简单的应用程序。

以下是我所遵循的创建简单hello world应用程序教程的链接。

http://grails-plugins.github.io/grails-spring-security-core/2.0.x/guide/tutorials.html

https://www.wave-access.com/public_en/blog/2014/june/23/how-we-configured-saml-20-on-grails.aspx

我终于可以让saml插件来配置了。

应用程序现在运行,但抛出500运行时错误,如下所示。

我已经到处找了一段时间,还没有找到任何有用的解决方案。应用程序和插件都是旧的,因为我必须使用grails 2.2。

我使用的是grails 2.2.

我感谢任何关于导致无线程绑定请求发现异常的原因的见解。

为了你的参考,我已经发布了代码在github

https://github.com/learningcscience/saml

谢谢!

|Loading Grails 2.2.0
No mavenInfo file found.
|Configuring classpath
.
|Environment set to development
.................................
|Packaging Grails application
....
|Compiling 1 source files
.............
|Running Grails application
Configuring Spring Security Core ...
... finished configuring Spring Security Core
Configuring Spring Security SAML ...
Registering metadata key: ping and value: security/idp-local.xml
...finished configuring Spring Security SAML
|Server running. Browse to http://localhost:8080/bookstore
Error |
2021-09-19 12:47:23,330 [http-bio-8080-exec-3] ERROR [/bookstore].[gsp]  - Servlet.service() for servlet [gsp] in context with path [/bookstore] threw exception
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.
Line | Method
->> 1152 | runWorker in java.util.concurrent.ThreadPoolExecutor
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    622 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    748 | run . . . in java.lang.Thread
Error |
2021-09-19 12:47:24,146 [http-bio-8080-exec-2] ERROR [/bookstore].[default]  - Servlet.service() for servlet [default] in context with path [/bookstore] threw exception
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.
Line | Method
->> 1152 | runWorker in java.util.concurrent.ThreadPoolExecutor
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    622 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    748 | run . . . in java.lang.Thread

快速查看您的配置后,看起来您还没有完成GRAILS上的SAML教程的第3步:

3。密钥管理器设置

  • […]
  • 下载并保存sp.xml到grails-app/conf/security/文件夹中。将我们在OpenAM服务器配置上生成的ipd.xml复制到同一文件夹中。在Config.groovy中添加sp和idp设置:
grails.plugins.springsecurity.saml.metadata.sp.file = 'security/sp.xml'
grails.plugins.springsecurity.saml.metadata.providers = [idp: 'security/idp.xml']
grails.plugins.springsecurity.saml.metadata.defaultIdp = 'idp'
grails.plugins.springsecurity.saml.metadata.sp.defaults = [
local: true,
alias: 'localSp',
securityProfile: 'metaiop',
signingKey: 'apollo',
encryptionKey: 'apollo',
requireArtifactResolveSigned: true,
requireLogoutRequestSigned: true,
requireLogoutResponseSigned: true
]

注意,教程说的是"Copy ipd.xml",这可能是一个打字错误。应该换成idp.xml吗?

最新更新