简体   繁体   English

无法解析 com.fasterxml.jackson.core.JsonGenerator 类型。 它是从所需的 .class 文件间接引用的

[英]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-databindjackson-core

Add jackson-core to your classpath in addition to jackson-databind.除了 jackson-databind 之外,将jackson-core添加到您的类路径中。

Steps :脚步 :

  1. Download jackson-core JAR file from here这里下载 jackson-core JAR 文件
  2. Right click on the project and go to properties > Build path > Libraries > classpath右键单击项目并转到属性> 构建路径> 库> 类路径
  3. Select 'Add external JARs'选择“添加外部 JAR”
  4. Choose the file location选择文件位置
  5. Click on 'Apply and close'.单击“应用并关闭”。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法解析org.codehaus.jackson.JsonGenerationException类型。 它是从所需的.class文件间接引用的 - The type org.codehaus.jackson.JsonGenerationException cannot be resolved. It is indirectly referenced from required .class files 无法解析com.ibm.mq.MQException类型。 从所需的.class文件间接引用它 - The type com.ibm.mq.MQException cannot be resolved. It is indirectly referenced from required .class files com.google.cloud.ServiceOptions$Builder 类型无法解析。 它是从 required.class 文件中间接引用的 - The type com.google.cloud.ServiceOptions$Builder cannot be resolved. It is indirectly referenced from required .class files 类型 com.google.protobuf.GeneratedMessageV3$Builder 无法解析。 它是从 required.class 文件间接引用的 - The type com.google.protobuf.GeneratedMessageV3$Builder cannot be resolved. It is indirectly referenced from required .class files 无法解析类型freemarker.core.Configurable。 从所需的.class文件间接引用它 - The type freemarker.core.Configurable cannot be resolved. It is indirectly referenced from required .class files SingleBOdy无法解决。 从所需的.class文件间接引用它 - SingleBOdy cannot be resolved. It is indirectly referenced from required .class files 无法解决 DataAccessException。 它是从所需的 .class 文件间接引用的 - DataAccessException cannot be resolved. It is indirectly referenced from required .class files 错误:无法解析com.sun.syndication.feed.synd.SyndFeedI类型。 从所需的.class文件间接引用它 - Error : The type com.sun.syndication.feed.synd.SyndFeedI cannot be resolved. It is indirectly referenced from required .class files 无法解析com.ibm.msg.client.jms.JmsQueue类型。 从所需的.class文件间接引用它 - The type com.ibm.msg.client.jms.JmsQueue cannot be resolved. It is indirectly referenced from required .class files MongoDB Java 驱动程序:无法解析类型 com.mongodb.client.model.InsertOneOptions。 它是从所需的 .class 文件间接引用的 - MongoDB Java Driver: The type com.mongodb.client.model.InsertOneOptions cannot be resolved. It is indirectly referenced from required .class files
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM