【发布时间】:2014-10-14 08:23:22
【问题描述】:
在这里,我在我的 eclipse 项目中使用 Jackson data binder 2.4.1 jar 库将对象转换为 json 格式。这是我的代码:
ObjectMapper mapper = new ObjectMapper();
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
mapper.writeValue(wr, content);
但在最后一行 mapper.writeValue(wr, content); 它给出了一个错误提示
The type com.fasterxml.jackson.core.JsonGenerator cannot be resolved. It is indirectly referenced from required .class files
我研究发现,当一个 jar 文件的类依赖于另一个不可用的类时,就会发生这种类型的错误。但是从我使用这个代码的地方 sn-p 没有这样的问题。但是我通过更改 JAR 版本失败了很多时间,但没有解决这个问题。怎么解决,求大神帮忙
【问题讨论】: