redis + Jedis + Spring集成之后运行报以下错误:
log4j:WARNNo appenders could be found for logger(org.springframework.core.env.StandardEnvironment).
log4j:WARNPlease initialize the log4j system properly.
SLF4J:Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J:Defaulting to no-operation (NOP) logger implementation
SLF4J:See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exceptionin thread "main" java.lang.VerifyError: Bad type on operand stack
ExceptionDetails:
Location:
org/springframework/data/redis/connection/jedis/JedisConnectionFactory.createRedisSentinelPool(Lorg/springframework/data/redis/connection/RedisSentinelConfiguration;)Lredis/clients/util/Pool;@57: invokespecial
Reason:
Type 'redis/clients/jedis/JedisPoolConfig'(current frame, stack[4]) is not assignable to'org/apache/commons/pool2/impl/GenericObjectPoolConfig'
Current Frame:
bci: @57
flags: { }
locals: {'org/springframework/data/redis/connection/jedis/JedisConnectionFactory','org/springframework/data/redis/connection/RedisSentinelConfiguration' }
stack: { uninitialized 0, uninitialized 0,'java/lang/String', 'java/util/Set', 'redis/clients/jedis/JedisPoolConfig',integer, 'java/lang/String' }
Bytecode:
0000000: bb00 2359 2bb6 0024 b900 2501 002a2bb6
0000010: 0026 b700 272a b600 28c6 000a 2ab60028
0000020: a700 0abb 0007 59b7 0008 2a2a b60012b7
0000030: 0029 2ab6 0012 b600 2ab7 002bb0
Stackmap Table:
full_frame(@35,{Object[#151],Object[#152]},{Uninitialized[#0],Uninitialized[#0],Object[#172],Object[#173]})
full_frame(@42,{Object[#151],Object[#152]},{Uninitialized[#0],Uninitialized[#0],Object[#172],Object[#173],Object[#153]})
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2532)
at java.lang.Class.getDeclaredConstructors(Class.java:1901)
atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:234)
atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1040)
atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1013)
atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
atorg.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:700)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at com.alifi.uums.start.StartApp.main(StartApp.java:22)
最后定位原因是因为jar包版本的原因,修改之前的jar包为:
jedis-2.1.0.jar + spring-data-redis-1.7.1.RELEASE.jar
最后决定将jedis-2.1.0.jar升级为jedis-2.9.0.jar
重新启动项目就没报错了