[英]The type com.fasterxml.jackson.core.JsonGenerator cannot be resolved. It is indirectly referenced from required .class files
Here I am using Jackson data binder 2.4.1 jar library in my eclipse project to convert an object to a json format.在这里,我在我的 eclipse 项目中使用 Jackson data binder 2.4.1 jar 库将对象转换为 json 格式。 And here is my code:
这是我的代码:
ObjectMapper mapper = new ObjectMapper();
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
mapper.writeValue(wr, content);
but in the last line mapper.writeValue(wr, content);
但在最后一行
mapper.writeValue(wr, content);
it gives an error saying它给出了一个错误说
The type com.fasterxml.jackson.core.JsonGenerator cannot be resolved. It is indirectly referenced from required .class files
I have studied and found that when a jar file's class is dependent on another class which is unavailable then this type of error occurs.我研究并发现,当一个 jar 文件的类依赖于另一个不可用的类时,就会发生这种类型的错误。 But from where I am using this code snippet there is no issue like this.
但是从我使用这个代码片段的地方来看,没有这样的问题。 But I have failed a lot of time by changing the JAR version but nothing solved this issue.
但是我通过更改 JAR 版本失败了很多时间,但没有解决这个问题。 How can I solve this, please help
我该如何解决这个问题,请帮忙
您的类路径中需要jackson-databind
和jackson-core
。
Add jackson-core to your classpath in addition to jackson-databind.除了 jackson-databind 之外,将jackson-core添加到您的类路径中。
Steps :脚步 :
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.