MyException - 我的异常网
当前位置:我的异常网» 软件架构设计 » jedis common 包冲突的有关问题

jedis common 包冲突的有关问题

www.MyException.Cn  网友分享于:2018-06-08  浏览:0次
jedis common 包冲突的问题

目前现状,jedis版本是2.4.2,没有引入common包

报错:

信息: Illegal access: this web application instance has been stopped already.  Could not load redis.clients.jedis.exceptions.JedisDataException.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1813)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1771)
	at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:63)
	at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:819)
	at org.apache.commons.pool2.impl.GenericObjectPool.ensureMinIdle(GenericObjectPool.java:863)
	at org.apache.commons.pool2.impl.BaseGenericObjectPool$Evictor.run(BaseGenericObjectPool.java:1001)
	at java.util.TimerThread.mainLoop(Timer.java:555)
	at java.util.TimerThread.run(Timer.java:505)

Exception in thread "commons-pool-EvictionTimer" java.lang.NoClassDefFoundError: redis/clients/jedis/exceptions/JedisDataException
	at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:63)
	at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:819)
	at org.apache.commons.pool2.impl.GenericObjectPool.ensureMinIdle(GenericObjectPool.java:863)
	at org.apache.commons.pool2.impl.BaseGenericObjectPool$Evictor.run(BaseGenericObjectPool.java:1001)
	at java.util.TimerThread.mainLoop(Timer.java:555)
	at java.util.TimerThread.run(Timer.java:505)
Caused by: java.lang.ClassNotFoundException: redis.clients.jedis.exceptions.JedisDataException
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1928)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1771)
	... 6 more

 查了半天,说是jar包冲突

解决办法:

将jedisjar包改成2.9.0

加入如下代码:

<dependency>
			<groupId>redis.clients</groupId>
			<artifactId>jedis</artifactId>
			<version>${jedis.version}</version>
			<exclusions>
				<exclusion>
					<artifactId>commons-pool2</artifactId>
					<groupId>org.apache.commons</groupId>
				</exclusion>
			</exclusions>
		</dependency>
                 <dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-pool2</artifactId>
			<version>2.4.2</version>
		</dependency>

分析原因:

jedis包中引用了common pool2的jar包

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有