Grails Error: No thread-bound request found: Are you referring to request attributes... After installing Spring Security Core
Solution 1
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.
Solution 2
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 황현정.
Solution 3
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>
황현정
Updated on June 28, 2022Comments
-
황현정 almost 2 years
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 -
raffian over 11 yearsvery nice, worked like a charm, but what is the
s2-quickstart
message that comes up from grails telling me to run that command? -
Keeth over 10 yearsThis fixed it for me in Grails 2.2.3, spring-security-core 1.2.7.3, thanks!!
-
bebbo over 9 yearsModifying the BuildConfig.groovy did not work for me, but adding "plugins.webxml=1.4.1" to the application.properties solved it. (I'm using ggts)