Redis + tomcat7

发布于 2015-09-27 / Linux / 0条评论 / 2,528浏览

直接上马
http://mvnrepository.com/open-source/tomcat-session-managers

<dependency>
  <groupId>ru.zinin</groupId>
  <artifactId>tomcat-redis-session</artifactId>
  <version>0.8</version>
</dependency>

1、更改context.xml

<Manager className="ru.zinin.redis.session.RedisManager" />

2、添加jar至tomcat\lib

commons-pool2-2.3.jar
jedis-2.6.2.jar
tomcat-redis-session-0.8.jar

3、报错

org.apache.catalina.LifecycleException: Failed to start component [ru.zinin.redis.session.RedisManager@7ba43f6d]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5526)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1948)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: org/apache/catalina/util/SessionIdGenerator
	at ru.zinin.redis.session.RedisManager.startInternal(RedisManager.java:529)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	... 12 more

4、find…from tomcat\lib ‘catalina.jar’

org/apache/catalina/util/
SessionIdGeneratorBase.class
StandardSessionIdGenerator.class

5、not find…

org/apache/catalina/util/SessionIdGenerator

6、各种下载tomcat版本查看里面的class
so

# wget http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.56/bin/apache-tomcat-7.0.56.zip

然后就ok了啊

sleep …
有时间把他/她的源码下下来,然后适配新版的tomcat

评论
站长统计