当前位置: 代码迷 >> 综合 >> There is no session with id [xxx]
  详细解决方案

There is no session with id [xxx]

热度:94   发布时间:2024-02-27 21:52:47.0
报错为:org.apache.shiro.session.UnknownSessionException: There is no session with id解决办法如下:
ShiroConfig类配置以下,将“sessionManager”方法中的setSessionIdCookie赋值改为以下
    sessionManager.setSessionIdCookie(sessionIdCookie());
    private SimpleCookie sessionIdCookie() {SimpleCookie cookie = new SimpleCookie();Long sessionIdL = new Long(System.currentTimeMillis());String sessionId = sessionIdL.toString();cookie.setName(sessionId);cookie.setHttpOnly(true);cookie.setMaxAge(30 * 60 * 1000);return cookie;}

 

  相关解决方案