Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No thread-bound request found error in controller promise #19

Open
4 tasks done
ryang-bgl opened this issue Mar 5, 2018 · 3 comments
Open
4 tasks done

No thread-bound request found error in controller promise #19

ryang-bgl opened this issue Mar 5, 2018 · 3 comments

Comments

@ryang-bgl
Copy link

ryang-bgl commented Mar 5, 2018

Thanks for reporting an issue for Grails Async, please review the task list below before submitting the
issue. Your issue report will be closed if the issue is incomplete and the below tasks not completed.

NOTE: If you are unsure about something and the issue is more of a question a better place to ask questions is on Stack Overflow (http://stackoverflow.com/tags/grails) or Slack (http://slack-signup.grails.org). DO NOT use the issue tracker to ask questions.

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

Steps to Reproduce

I am trying to upgrade a grails 2.5.4 application to grails 3.3.2. Some of the codes used to work now couldn't work. Basically, the issue is that the async task in the controller is referencing request.params which is not available in the async thread.

I created a 2.5.4 project (demo254) and a 3.3.2 project (demo332) to demonstrate the issue. Both projects have the same controller and view code.

Please refer to the readme in https://github.com/ruiyang/grails-issue-demo.git to reproduce.

Expected Behaviour

I am not sure about the expected behaviour. I just need to know if there is any way I could get this code working to avoid a lot of rewrites.

Actual Behaviour

Exception:
URI /helloWorld
Class . java.lang.IllegalStateException
Message . null
Caused by: 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.

Environment Information

  • Operating System: MacOs
  • Grails Version: 2.5.4 VS 3.3.2
  • JDK Version: 8

Example Application

@jaguar1975cn
Copy link

I have the same issue on 3.3.6. Any news about this problem? Thanks

@mortensoby
Copy link

I have the same problem with 3.3.9

@ppazos
Copy link

ppazos commented Sep 16, 2021

I have found using this in controllers and running integration tests will cause the problem, I'm on Grails 3.3.10:

class XXXController {
   def config = grailsApplication.config
   ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants