本文介绍了Redisson NoSuchFieldError:WRITE_BIGDECIMAL_AS_PLAIN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚通过maven导入redisson 1.0.3,在默认端口上的localhost上设置了redis-server,并想尝试redisson redis客户端。我的测试代码如下所示:
I just imported redisson 1.0.3 via maven, set up a redis-server on localhost on default port and wanted to try the redisson redis client. My test code looks as following:
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 ...
正如我添加了依赖项:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.3.3</version>
</dependency>
但是没有变化...
我猜redisson的依赖关系在某种程度上被打破但我怎么能解决这个问题?
But no change...I guess redisson's dependencies are somehow broken but how can I fix this?
推荐答案
好像我的classpath已经包含了一个旧版本的jackson,这修复了它:
It seems like my classpath already contained an older version of jackson, this fixed it:
<!-- 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>
这篇关于Redisson NoSuchFieldError:WRITE_BIGDECIMAL_AS_PLAIN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!