I'm using tomcat7 with oracle-java8 in Ubuntu16.04.
And I start 2 different tomcat instances for load balancing, but the default behavior is that the session cannot share between them.
So I turned to the solution using RedisSessionManager in it.
After I add the below lines in the tomcat conf/context.xml
file (of course I did added the dependency jars in the lib directory):
<Valve className="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve" /><Manager className="com.orangefunction.tomcat.redissessions.RedisSessionManager" host="127.0.0.1" port="6379" database="0" password="defuRedis2017" maxInactiveInterval="60" />
Then start a single tomcat instance.
But after that, the server seemed cannot save session any more, and returned a different Set-Cookie header in each request, so the login cannot work any more even with a single tomcat instance.
If I comment out the above lines (in the context.xml
file), the session works as expected.
So what makes it wrong to working with the RedisSesssionManager
?