|
用redis和tomcat进行集群,登录时候checkuser方法,可以正常从缓存中获取TSuser
登录时候
public String login(ModelMap modelMap, HttpServletRequest request,
HttpServletResponse response) {
TSUser user = ResourceUtil.getSessionUserName();//获取到的user没有id ,id=null 其他字段都正常获取
tomcat版本7.047
tomcat 额外引入jar包为
commons-pool2-2.4.2.jar
tomcat-redis-session-manage-tomcat7.jar
jedis-2.9.0.jar
context.xml 配置
<Valve className="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve" />
<Manager className="com.orangefunction.tomcat.redissessions.RedisSessionManager"
host="127.0.0.1"
port="6379"
database="0"
maxInactiveInterval="60" />
|
|