1. 程式人生 > >org.apache.shiro.session.UnknownSessionException: There is no session with id[xx]

org.apache.shiro.session.UnknownSessionException: There is no session with id[xx]

問題背景:

借鑑開濤的shiro教程,自己動手實驗下,關於第16章,使用的框架是shiro+spring MVC+maybatis,一啟動就直接拋這個異常。

解決辦法:

1,
配置檔案 中關於Bean:securityManager中property為sessionManager註釋掉即可。(不可取)
2,
因sessionManager受CacheManager,而專案中又手動繼承實現了shiro中CacheManager的getCache方法,預設返回null(錯誤),將修改為返回自實現shiro中Cache介面。
現將解決辦法,記錄下,後續詳細研究下,錯誤原因。