【发布时间】:2015-03-05 18:53:34
【问题描述】:
我创建了一个在 XML 请求中运行良好的 Rest Service(Rest Service 输入 JAXB 生成的类)。当我尝试发送 Json 请求时,它会引发异常。
SEVERE: The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container
org.codehaus.jackson.map.JsonMappingException: Can not instantiate value of type [simple type, class Transaction] from JSON String; no single-String constructor/factory method (through reference chain:
class Transaction which is inner class .
我的 Request 类是使用 JAXB 从模式生成的,我的 getter 方法如下所示,但没有 setter 方法。
public List<Transaction> getORIG() {
if (origtrans == null) {
origtrans = new ArrayList<Transaction>();
}
return this.origtrans;
}
下面是我的 Json 请求
{
"LOB_CD": "42424"
"ORIGINALTRANSACTION" : [
"LOGON_ID" : "TEST"
]
}
当我添加原始事务时,它会抛出一个错误,否则它工作正常。
你能帮我解决这个问题吗? 提前致谢。
【问题讨论】: