search

Home  >  Q&A  >  body text

java - Problems in tomcat using redis to share sessions. Sessions cannot be shared.

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

怪我咯怪我咯2773 days ago872

reply all(2)I'll reply

  • 大家讲道理

    大家讲道理2017-05-18 10:47:33

    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

    reply
    0
  • 某草草

    某草草2017-05-18 10:47:33

    spring-session

    reply
    0
  • Cancelreply