<big id="yeiyz"><ruby id="yeiyz"></ruby></big>
    <track id="yeiyz"></track>
    <track id="yeiyz"></track>
    <p id="yeiyz"><del id="yeiyz"></del></p><td id="yeiyz"><option id="yeiyz"></option></td>
    1. <p id="yeiyz"></p>

      <td id="yeiyz"></td>

      springboot2.x引入spring-boot-starter-data-redis依賴,啟動報錯

      阿飛千秋萬載 發布于 10/10 11:53
      閱讀 203
      收藏 0

      springboot2.x引入spring-boot-starter-data-redis依賴,啟動報錯,redis框架用的jedis就沒問題,2.x默認用的是lettuce卻出現了以下錯誤,為什么會這樣,這個問題折騰了兩三天了,快點來個大神拯救我吧
      pom:

      報錯:
      org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'application': Unsatisfied dependency expressed through field 'stringredistemplate'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'stringRedisTemplate' defined in class path resource [org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration.class]: Unsatisfied dependency expressed through method 'stringRedisTemplate' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisConnectionFactory' defined in class path resource [org/springframework/boot/autoconfigure/data/redis/LettuceConnectionConfiguration.class]: Unsatisfied dependency expressed through method 'redisConnectionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lettuceClientResources' defined in class path resource [org/springframework/boot/autoconfigure/data/redis/LettuceConnectionConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.lettuce.core.resource.DefaultClientResources]: Factory method 'lettuceClientResources' threw exception; nested exception is java.lang.NoClassDefFoundError: io/netty/util/internal/logging/InternalLoggerFactory
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596)
      at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90)
       

      加載中
      1
      KevinBlandy
      KevinBlandy

      添加一個依賴

      <dependency>
      	<groupId>io.lettuce</groupId>
      	<artifactId>lettuce-core</artifactId>
      </dependency>

       

      阿飛千秋萬載
      回復 @阿飛千秋萬載 : 手動下載lettuce包成功運行了
      阿飛千秋萬載
      你好,我加了,然而還是報同樣錯誤
      0
      c
      cquzxs

      問題點: java.lang.NoClassDefFoundError: io/netty/util/internal/logging/InternalLoggerFactory 

      加上這個包試一下

      <!-- https://mvnrepository.com/artifact/org.elasticsearch.plugin/transport-netty4-client -->
      <dependency>
          <groupId>org.elasticsearch.plugin</groupId>
          <artifactId>transport-netty4-client</artifactId>
          <version>7.1.0</version>
      </dependency>
       

       


       

      阿飛千秋萬載
      回復 @zb40251488 : 手動下載lettuce包成功運行了
      zb40251488
      zb40251488
      是缺少netty-all的包, <dependency> ?? ?<groupId>io.netty</groupId> ?? ?<artifactId>netty-all</artifactId> <version>4.0.24.Final</version> </dependency>
      0
      cafelication
      cafelication

      版本問題 用這個替換掉之前的 springboot-start-data-redis

      <!--Spring整合redis包 -->
      <dependency>
         <groupId>org.springframework.data</groupId>
         <artifactId>spring-data-redis</artifactId>
         <version>2.1.3.RELEASE</version>
      </dependency>
      <!-- https://mvnrepository.com/artifact/redis.clients/jedis -->
      <!-- https://mvnrepository.com/artifact/redis.clients/jedis -->
      <dependency>
         <groupId>redis.clients</groupId>
         <artifactId>jedis</artifactId>
         <version>2.9.1</version>
      </dependency>
      返回頂部
      頂部
      聚看影院