Подтвердить что ты не робот

Ошибка Grails: не найдено ни одного связанного с потоком запроса: ссылаетесь ли вы на атрибуты запроса... После установки Spring Security Core


Я только что создал новое приложение grails-app,
все было хорошо, пока я не решил, для установки Spring Security Core.

После установки Spring Security Core
сделав s2-quickstart и нажав
grails run-app, он произвел следующая ошибка:

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.

Кто-нибудь знает, как это исправить?
Я был бы очень признателен, если бы Вы поможете. Я пробовал искать ответы на других сайтах, однако Я не смог его решить.:)
BTW, я использую:
Spring Security Core 1.2.4
Grails 2.0.0.RC1

4b9b3361

Ответ 1

Если вы используете Maven, убедитесь, что у вас есть это на вашем pom.xml:

<dependency>
    <groupId>org.grails.plugins</groupId>
    <artifactId>webxml</artifactId>
    <version>1.4.1</version>
    <scope>runtime</scope>
    <type>zip</type>
</dependency>

и в BuildConfig, groovy:

runtime ":webxml:1.4.1"

Это решило проблему для меня с Grails 2.2.0.

Ответ 2

Это может произойти, если вы используете более старую версию Spring Security Core. Я ударил это при обновлении от grails 1.3.7 (и Spring security 1.1.3) до grails 2.0.0. Исправление заключалось в изменении на spring -security-core 1.2 в application.properties:

plugins.spring-security-core=1.2

Дополнительная информация на http://jira.grails.org/browse/GPSPRINGSECURITYCORE-98, как предложено 황현정.

Ответ 3

Попробуйте зарегистрировать прослушиватель RequestContextListener в файле web.xml.

Файл: web.xml

<web-app>
   ...
   <listener>
    <listener-class>
        org.springframework.web.context.request.RequestContextListener
    </listener-class>
   </listener>
</web-app>