java - Problems in tomcat using redis to share sessions. Sessions cannot be shared.
怪我咯
怪我咯 2017-05-18 10:45:33
0
2
876

Now that it is configured, the session can be stored in redis, but the session is not shared
JSESSIONID=85BA6B206C53213A7147C31C1FDEA7B9.webuiApp
JSESSIONID=F75A1BBC59A873467CF6872F9C40A140.webuiApp2
webuiApp and webuiApp2 are The names of my two tomcats What settings do tomcat need now to allow two tomcats to share session

  1. List items

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(2)
大家讲道理

The HttpSession that comes with the servlet does not implement the Serialize interface and cannot be stored in redis. Since your session can be stored in redis, it means that you are using a custom session.
I don’t know which framework you are using? If you don't use a framework, you need to implement the session management method yourself.
The general idea is as follows:

  1. The jredis client is integrated into the project to manage the connection to redis for management

  2. Customized interceptor to implement session creation/modification/deletion methods. The implementation code is to process the data in redis

It is more complicated to implement it yourself

It is recommended that you use the framework Apache Shiro, which is a security framework and has its own session. He has implemented ehcache to store sessions.
If you want to use other caches (such as redis), you need to write the code yourself. Not very complicated

某草草

spring-session

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template