小编典典

Redisson NoSuchFieldError:WRITE_BIGDECIMAL_AS_PLAIN

redis

我刚刚通过Maven导入了Redisson 1.0.3,在默认端口上的本地主机上设置了Redis服务器,并想尝试Redisson
Redis客户端。我的测试代码如下:

Redisson redis = Redisson.create();
Map m = redis.getMap("someMap");

但我得到:

java.lang.NoSuchFieldError: WRITE_BIGDECIMAL_AS_PLAIN
    at org.redisson.codec.JsonJacksonCodec.createObjectMapper(JsonJacksonCodec.java:90)
    at org.redisson.codec.JsonJacksonCodec.<init>(JsonJacksonCodec.java:43)
    at org.redisson.Config.<init>(Config.java:44)
    at org.redisson.Redisson.create(Redisson.java:85)
    at ...

Redisson中的建议:WRITE_BIGDECIMAL_AS_PLAIN,我添加了依赖项:

    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>2.3.3</version>
    </dependency>

但是没有变化…我猜想redisson的依赖关系被打破了,但是我该如何解决呢?


阅读 429

收藏
2020-06-20

共1个答案

小编典典

看来我的类路径已经包含了杰克逊的旧版本,对此进行了修复:

    <!-- Redis deps -->
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>2.3.2</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.3.0</version>
    </dependency>

    <dependency>
        <groupId>org.redisson</groupId>
        <artifactId>redisson</artifactId>
        <version>1.0.3</version>
    </dependency>
2020-06-20