I. BACKGROUND
Recently, after integrating the Spring+shiro+redis implementation of the Tomcat cluster session sharing issue, After the release of the run after the discovery will always appear: Org.apache.shiro.session.UnknownSessionException:There is no session with ID [xxxx] problem, the specific problem is as follows:
Second, the cause of this problem
This problem occurs because, in the Defaultwebsessionmanager class of Shiro, the default cookie name is Jsessionid, which conflicts with the servlet container name, such as Jetty, The default jsessionid, such as Tomcat, is lost when jumping out of the Shiro servlet, such as Error-page container will reassign values for Jsessionid!
Understand the cause of this problem, it is good to do, we just have to specify a project to run the container does not conflict with the SessionID, as follows, in the Spring-shiro.xml to configure the following:
class= "Org.apache.shiro.web.session.mgt.DefaultWebSessionManager" > <property name= " Sessiondao "ref=" Redissessiondao "/> <property name=" Sessionidcookie "ref=" Simplecookie "/> <bean id= "Simplecookie" class= "Org.apache.shiro.web.servlet.SimpleCookie" > <constructor-arg Name = "Name" value= "Shiro.sesssion"/> <property name= "path" value= "/"/> </bean>
In this way, we have solved this problem perfectly! For those who want to know Spring+shiro+redis integrated implementation of the Tomcat cluster session sharing of children's shoes, please visit:Shrio+redis realize the Tomcat cluster sharing session
Solve the problem with ID for Org.apache.shiro.session.UnknownSessionException:There is no session