Solve the problem with ID for Org.apache.shiro.session.UnknownSessionException:There is no session

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.