我已阅读JSONMappingException for External Object,JSONMappingException for Class但无法找到ObjectNode
课程的解决方案。
阅读JSONMappingException for External Object 我知道你必须在mapper中注册Object但我没有创建任何ObjectMapper类,因为我正在调用web服务
mapper.registerModule(new GeoModule());
我正在尝试调用包含ReportQueryData.java
(com.fasterxml.jackson.databind.node.ObjectNode)实例变量的My POJO(ObjectNode
)的Web服务。
ReportQueryData.java
import com.fasterxml.jackson.databind.node.ObjectNode;
public class ReportQueryData {
private ObjectNode parentsData;
public ObjectNode getParentsData() {
return parentsData;
}
public void setParentsData(ObjectNode parentsData) {
this.parentsData = parentsData;
}
}
现在我在请求中调用包含ReportQueryData的Web服务,我面临异常
org.codehaus.jackson.map.JsonMappingException: No suitable constructor found for type [simple type, class com.fasterxml.jackson.databind.node.ObjectNode]: can not instantiate from JSON object (need to add/enable type information?)
[INFO] [talledLocalContainer] at [Source: org.apache.catalina.connector.CoyoteInputStream@3da45801; line: 1, column: 155] (through reference chain: com.atlassian.qtm.model.ReportQueryData["parentsData"])
[INFO] [talledLocalContainer] at org.codehaus.jackson.map.JsonMappingException.from(JsonMappingException.java:163)
[INFO] [talledLocalContainer] at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObjectUsingNonDefault(BeanDeserializer.java:740)
[INFO] [talledLocalContainer] at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:683)
答案 0 :(得分:0)
您必须为此类编写默认构造函数,如此
class A{
A(String s){
}
}
class B extends A{
B(){
super("str");
}
}
编辑:尝试将该课程包装在您的课程中并使用您的课程。
m[eval(parse(text=query))]
# Hugo_Symbol Variant_Classification Variant_Type Tumor_Sample_Barcode
#1: ABCA10 Splice_Site SNP TCGA.AB.2988
#2: ADSS Splice_Site SNP TCGA.AB.2912