Redisson NoSuchFieldError:WRITE_BIGDECIMAL_AS_PLAIN

时间:2014-04-15 12:36:09

标签: java maven redis client jackson

我刚刚通过maven导入redisson 1.0.3,在默认端口上的localhost上设置了redis-server,并想尝试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的依赖关系在某种程度上被打破了,但我该如何解决这个问题呢?

1 个答案:

答案 0 :(得分:1)

似乎我的classpath已经包含了旧版本的jackson,这修复了它:

    <!-- 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>