Spring Jedis使用spring-date-redis和springboot时出错。
我正在使用:
spring-data-redis版本:2.0.0.RELEASE
Spring Jedis版本:2.9.0
Spring-boot版本:1.5.8.RELEASE带来Spring 4.3.12.RELEASE
在Maven Respository中,spring-data-redis 2.0.0.RELEASE依赖项Jedis 2.9.0。和Jedis 2.9.0依赖关系commons-pool2 2.4.2
所以似乎没问题,至少没有版本错误?
我的日志是:
Type Exception Report
Message Servlet.init() for servlet [springServlet] threw exception
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
异常追踪:
javax.servlet.ServletException: Servlet.init() for servlet [springServlet] threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1457)
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:748)
根本原因:
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'userController': Injection of autowired dependencies failed;
nested exception is org.springframework.beans.factory.BeanCreationException:
Could not autowire field: private
com.shinian.lea.service.user.UserTeamInfoService
com.shinian.lea.controller.pve.user.UserController.userTeamInfoService;
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'userTeamInfoService': Injection of autowired
dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not autowire
field: private org.springframework.data.redis.core.StringRedisTemplate
com.shinian.lea.service.user.UserTeamInfoService.redisTemplate; nested
exception is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'StringRedisTemplate' defined in file
[E:\TimeYears\LEA\trunk\target\lea-0.0.1\WEB-
INF\classes\applicationContext.xml]: Initialization of bean failed; nested
exception is java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
org/springframework/data/redis/connection/jedis/JedisConnectionFactory.
<init>
(Lorg/springframework/data/redis/connection/RedisClusterConfiguration;Lredis
/clients/jedis/JedisPoolConfig;)V @43: invokestatic
原因:
Type 'redis/clients/jedis/JedisPoolConfig' (current frame, stack[1]) is not assignable to 'org/apache/commons/pool2/impl/GenericObjectPoolConfig'
当前框架:
bci: @43
flags: { }
locals: { 'org/springframework/data/redis/connection/jedis/JedisConnectionFactory', 'org/springframework/data/redis/connection/RedisClusterConfiguration', 'redis/clients/jedis/JedisPoolConfig' }
stack: { 'org/springframework/data/redis/connection/jedis/JedisConnectionFactory', 'redis/clients/jedis/JedisPoolConfig' }
字节码:
0x0000000: 2ab7 0004 2a03 b500 052a 04b5 0006 2abb
0x0000010: 0007 5912 0811 18eb b700 0ab5 000b 2b12
0x0000020: 19b8 000d 2a2b b500 1a2a 2cb8 0017 b500
0x0000030: 0eb1
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1208)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:762)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:631)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:588)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:645)
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:508)
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:449)
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133)
javax.servlet.GenericServlet.init(GenericServlet.java:158)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1457)
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:748)
有关此错误的任何帮助吗?