SpringBoot 集成Redisson问题

Spring Boot 集成Redisson问题

  1. yml配置错误

    Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "pingTimeout" (class org.redisson.config.SingleServerConfig), not marked as ignorable (25 known properties: "timeout", "subscriptionsPerConnection", "keepAlive", "sslKeystorePassword", "retryInterval", "retryAttempts", "idleConnectionTimeout", "sslTruststorePassword", "sslEnableEndpointIdentification", "address", "sslTruststore", "username", "connectTimeout", "subscriptionConnectionPoolSize", "password", "sslProvider", "tcpNoDelay", "connectionMinimumIdleSize", "subscriptionConnectionMinimumIdleSize", "sslKeystore", "pingConnectionInterval", "clientName", "connectionPoolSize", "database", "dnsMonitoringInterval"])
     at [Source: (StringReader); line: 3, column: 20] (through reference chain: org.redisson.config.Config["singleServerConfig"]->org.redisson.config.SingleServerConfig["pingTimeout"])
    
    • 原因 :

      • 官方Github的文档中 , 中文语言的Wiki文档,在单节点模式配置很明显就问题,一看源码才发现SingleServerConfig和org.redisson.config.Config根本就没有中文Wiki文档Yaml文件的一些配置。然后我又看了英文文档的,发现两个文档的配置有出入。果断英文文档的配置是可以使用的
    • 解决 :

      singleServerConfig:
        idleConnectionTimeout: 10000
        connectTimeout: 10000
        timeout: 3000
        retryAttempts: 3
        retryInterval: 1500
        # 如果Redis服务端配置有密码需要替换password的值
        password: null
        subscriptionsPerConnection: 5
        clientName: null
        # 替换为自己真实Redis服务端连接
        address: "redis://127.0.0.1:6379"
        subscriptionConnectionMinimumIdleSize: 1
        subscriptionConnectionPoolSize: 50
        connectionMinimumIdleSize: 24
        connectionPoolSize: 64
        database: 0
        dnsMonitoringInterval: 5000
      threads: 16
      nettyThreads: 32
      codec: !<org.redisson.codec.FstCodec> {}
      transportMode: "NIO"
      
  2. ClassNotFoundException

    Failed to instantiate [org.redisson.api.RedissonClient]: Factory method 'redissonClient' threw exception; nested exception is java.lang.NoClassDefFoundError: Lorg/nustaq/serialization/FSTConfiguration;
    
    • 导入对应类依赖即可

      • org.nustaq.serialization.FSTConfiguration

        <dependency>
          <groupId>de.ruedigermoeller</groupId>
          <artifactId>fst</artifactId>
          <version>2.04</version>
        </dependency>
        
posted @ 2021-11-22 15:13  Jancy丶  阅读(2967)  评论(0编辑  收藏  举报