相关文章推荐
怕老婆的针织衫  ·  UICollectionViewFlowLa ...·  1 年前    · 
酒量小的红烧肉  ·  php ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Grails Error: No thread-bound request found: Are you referring to request attributes... After installing Spring Security Core

Ask Question 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:

/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

What controller does the URI /test1/ hit? What action is it taking? Any code you could post from the controller would help, as it's likely something within the controller or a service that isn't within the transactional session. Todd Nov 5, 2011 at 0:31 Hello, I just scaffolded all of my controllers, except for the ones produced by Spring Security Core itself. /test1/ is the name of my app. :) 황현정 Nov 5, 2011 at 15:39 I just tried creating a project, adding a domain class, generate-all on that domain, install spring-security-core, ran the s2-quickstart, and it worked fine. Have you tried grails clean? Todd Nov 5, 2011 at 16:10 Yup... Grails clean was actually the first thing that I did but with no luck.. I tried it again upon your request but still the same.. Hmm.. There must be something wrong somewhere, all my other apps seem to be running smoothly. Sorry I'm not really that familiar with servlets and stuff. :( 황현정 Nov 5, 2011 at 18:43 I was not able to solve the problem yet.. But looking around grails.jira... It seems like some people have the same problem as I am.. jira.grails.org/browse/GPSPRINGSECURITYCORE-98 황현정 Nov 5, 2011 at 18:52 Modifying 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) bebbo Dec 18, 2014 at 16:12

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 황현정.

very nice, worked like a charm, but what is the s2-quickstart message that comes up from grails telling me to run that command? – raffian Aug 7, 2012 at 17:56 <listener-class> org.springframework.web.context.request.RequestContextListener </listener-class> </listener> </web-app>

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.