no thread-bound request found:are you referring to request

問題描述:

通過webservice接口調用程序時,發現在執行查詢的時候一直報一個錯誤,錯誤信息如下:

java.lang.IllegalStateExceptino: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......

解決方法:

在web.xml文件中配置這句話就ok了

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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章