gpt4 book ai didi

java - org.codehaus.jackson.map.JsonMappingException : Conflicting setter definitions for property "matchColumn": com. sun.rowset.JdbcRowSetImpl

转载 作者:行者123 更新时间:2023-12-02 11:58:27 35 4
gpt4 key购买 nike

我正在使用 Jackson 反序列化 com.sun.rowset.JdbcRowSetImpl 类的对象:

public class Main {

static String jsonInput = "{\"@class\":\"com.sun.rowset.JdbcRowSetImpl\", \"dataSourceName\":\"ldap://localhost:10389/ldap://localhost:10389/cn=apartment16,dc=example,dc=com\", \"autoCommit\":true}";


public static void main(String[] args) throws Exception{
ObjectMapper mapper = new ObjectMapper();
mapper.enableDefaultTyping();
Object o = mapper.readValue(jsonInput, JdbcRowSetImpl.class);
System.out.println(o.getClass());
}
}

但我遇到以下异常:

Exception in thread "main" org.codehaus.jackson.map.JsonMappingException: Conflicting setter definitions for property "matchColumn": com.sun.rowset.JdbcRowSetImpl#setMatchColumn(1 params) vs com.sun.rowset.JdbcRowSetImpl#setMatchColumn(1 params)
at org.codehaus.jackson.map.deser.StdDeserializerProvider._createAndCache2(StdDeserializerProvider.java:346)
at org.codehaus.jackson.map.deser.StdDeserializerProvider._createAndCacheValueDeserializer(StdDeserializerProvider.java:321)
at org.codehaus.jackson.map.deser.StdDeserializerProvider.findValueDeserializer(StdDeserializerProvider.java:167)
at org.codehaus.jackson.map.deser.StdDeserializerProvider.findTypedValueDeserializer(StdDeserializerProvider.java:188)
at org.codehaus.jackson.map.ObjectMapper._findRootDeserializer(ObjectMapper.java:2820)
at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2719)
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1854)
at test.Main.main(Main.java:25)
Caused by: java.lang.IllegalArgumentException: Conflicting setter definitions for property "matchColumn": com.sun.rowset.JdbcRowSetImpl#setMatchColumn(1 params) vs com.sun.rowset.JdbcRowSetImpl#setMatchColumn(1 params)
at org.codehaus.jackson.map.introspect.POJOPropertyBuilder.getSetter(POJOPropertyBuilder.java:198)
at org.codehaus.jackson.map.deser.BeanDeserializerFactory.addBeanProps(BeanDeserializerFactory.java:1056)
at org.codehaus.jackson.map.deser.BeanDeserializerFactory.buildBeanDeserializer(BeanDeserializerFactory.java:654)
at org.codehaus.jackson.map.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:583)
at org.codehaus.jackson.map.deser.StdDeserializerProvider._createDeserializer(StdDeserializerProvider.java:432)
at org.codehaus.jackson.map.deser.StdDeserializerProvider._createAndCache2(StdDeserializerProvider.java:341)
... 7 more

我猜这是因为 Jackson 不知道应该对“matchColumn”字段使用哪个 setter(有 4 个)。但我不知道为什么它甚至尝试设置该字段,因为我没有在 JSON 中声明任何“matchColumn”属性...有什么想法吗?

最佳答案

问题已解决:我使用的是旧版本的 jackson。 2.7 版本对我来说效果很好

关于java - org.codehaus.jackson.map.JsonMappingException : Conflicting setter definitions for property "matchColumn": com. sun.rowset.JdbcRowSetImpl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47435134/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com