【发布时间】:2012-01-02 10:34:23
【问题描述】:
我有一个在 Windows 上运行良好的 Grails 2.0.0.RC1 应用程序。但是,当我尝试在 Ubuntu 下运行它时,每当我尝试加载页面时都会收到以下错误消息:
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.
我对上面消息中的DispatcherServlet/DispatcherPortlet 有点惊讶,因为我没有在这个应用程序中使用 portlet。
另外,当我启动应用程序时,我会看到很多类似以下的日志消息,这些消息在 Windows 下运行时不会出现:
DEBUG resource.ResourceTagLib - Resource: /images/tab_l.png - disposition image - rendering disposition defer
DEBUG resource.ResourceTagLib - Resource: /images/tab_r.png - disposition image - rendering disposition defer
DEBUG resource.ResourceTagLib - Resource: /images/tab_m.png - disposition image - rendering disposition defer
【问题讨论】:
-
消息提到 DispatcherServlet/DispatcherPortlet 只是因为显然这个问题在这两种情况下都会出现。使用 grails,您确实在后台使用 DispatcherServlet,因此您可以忽略 DispatcherPortlet 的提及