Tag Archives: Redisson Error

[Solved] redisson Error: IllegalArgumentException: port out of range:-1

Reason for putting it first: [version incompatibility]

Exception:

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [redis.client.RedisClient]: Factory method ‘redisClient’ threw exception; nested exception is java.lang.IllegalArgumentException: port out of range:-1

Port out of range: – 1

Solution:

Find a private blog in the vast sea of articles, and modify the reisson version, Cao, under the tips of the boss’s post

Finally, reload pom.xml again

Redis based distributed lock implementation in springboot (via redisson)

[Solved] Redisson Error: Caused by: java.lang.IllegalArgumentException: RIVER

Spring integrates redisson and reports an error when starting the project: caused by: java.lang.illegalargumentexception: River

package com.user.base.utils.redis.redisson;

import java.io.IOException;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * get redisson
 * @author Administrator
 *
 */
@Configuration
public class RedissonConfig {
    /*
     * SecondKillServiceImp.java
     */
    @Bean/*(destroyMethod = "shutdown")*/
    RedissonClient redisson(){ // throws IOException 
        Config config = new Config();
        //config.useClusterServers().addNodeAddress("127.0.0.1:6379");
        config.useSingleServer().setAddress("redis://127.0.0.1:64791");
        //config.useClusterServers().addNodeAddress("redis://127.0.0.1:6379","redis://127.0.0.1:6380");
        config.setCodec(new org.redisson.client.codec.StringCodec());
        RedissonClient redissonClient = null;
        try{
            redissonClient = Redisson.create(config);
        }catch(Exception e){
            e.printStackTrace();
        }
        return redissonClient;
    }
}

Solution: add

config.setCodec(new org.redisson.client.codec.StringCodec());

After adding this sentence, the exception is excluded.

//Specify the code. The default code is org.redisson.codec.jsonjacksoncode
// the previous spring data redis and the client jedis are encoded as org.springframework.data.redis.serializer.stringredisserializer
// after redisson is used, in order to ensure data compatibility between them, the code is modified to org.redisson.client.codec.stringcodec