tomcat6 redis session共享

来源:互联网 发布:丑陋的中国人 知乎 编辑:程序博客网 时间:2024/06/16 13:30

准备工作

下载 安装redis   windows下载地址为:https://github.com/ServiceStack/redis-windows 

两个tomcat6

jar包

commons-pool-1.5.4 ,  jedis-2.2.1  ,tomcat-redis-session-manager-1.2-tomcat-6

其中tomcat-redis-session-manager-1.2-tomcat-6的下载地址为:https://github.com/jcoleman/tomcat-redis-session-manager/downloads


commons-pool-1.5.4 ,jedis-2.2.1  ,tomcat-redis-session-manager-1.2-tomcat-6这三个jar包放入tomcat/lib 目录下面




然后在tomcat  context.xml  添加  

<Valve className="com.radiadesign.catalina.session.RedisSessionHandlerValve" />;
<Manager className="com.radiadesign.catalina.session.RedisSessionManager"
host="localhost"
 port="6379"
database="0"
maxInactiveInterval="600"/>

这段配置  就OK了 



另外不是很懂jar的搭配  为什么 commons-pool-1.5.4 + jedis-2.2.1 就可以   commons-pool-1.5.4 ,  jedis-2.5.2就不行呢?启动报错





0 0