您好,环境是这样的模块adminhttp://localhost:8081/admin/login 得到sessionid是
22:05:38 DEBUG net.sf.ehcache.Cache - Cache: admin-SessionCache store hit for 1a22b751-0542-4e74-a8e7-59942692f6ae
模块userhttp://localhost:8082/user/login 得到sessionid是
22:07:01 DEBUG net.sf.ehcache.Cache - Cache: user-SessionCache store hit for 38c7d0d9-b13c-42f5-9e36-304838838c02
当admin登陆成功后,去刷新user(并不登陆,就在登陆页面刷新)这个时候admin就会自动退出登陆,且提示
22:13:37 DEBUG o.a.shiro.web.servlet.SimpleCookie - Found 'sid' cookie value [38c7d0d9-b13c-42f5-9e36-304838838c02]
22:13:37 DEBUG net.sf.ehcache.Cache - mx-master-SessionCache cache - Miss
22:13:37 DEBUG o.a.shiro.mgt.DefaultSecurityManager - Resolved SubjectContext context session is invalid. Ignoring and creating an anonymous (session-less) Subject instance.
org.apache.shiro.session.UnknownSessionException: There is no session with id [38c7d0d9-b13c-42f5-9e36-304838838c02]
user也会报错,提示
22:13:37 DEBUG o.a.shiro.web.servlet.SimpleCookie - Found 'sid' cookie value [1a22b751-0542-4e74-a8e7-59942692f6ae]
22:13:37 DEBUG net.sf.ehcache.Cache - mx-master-SessionCache cache - Miss
22:13:37 DEBUG o.a.shiro.mgt.DefaultSecurityManager - Resolved SubjectContext context session is invalid. Ignoring and creating an anonymous (session-less) Subject instance.
org.apache.shiro.session.UnknownSessionException: There is no session with id [1a22b751-0542-4e74-a8e7-59942692f6ae]
两个id是串联起来了一样,求解决办法,但是如果这2个模块,在不同浏览器下,就不会出现这个问题,难道是session的name一样导致的吗?admin覆盖user,或者user覆盖admin
4 回答
慕码人2483693
TA贡献1860条经验 获得超9个赞
解决办法:
<!-- 会话Cookie模板 -->
<bean id="sessionIdCookie" class="org.apache.shiro.web.servlet.SimpleCookie">
<constructor-arg value="sid"/>
**<!--设置Cookie名字,默认为JSESSIONID-->
<property name="name" value="WEBSID" />**
</bean>
2个web模块,分别设置不同的sessionIdCookie的name即可
感谢3楼的哥们(geshiwuyu)
白板的微信
TA贡献1883条经验 获得超3个赞
同一个域名服务器在客户端只能存在同一个key名的session或cookie,如果不希望互相干扰,可以把其中一个localhost改为其它名字,如'127.0.0.1'或者你自己的ip地址。
添加回答
举报
0/150
提交
取消
