【发布时间】:2015-07-29 17:35:40
【问题描述】:
我在发送 JSON 格式的 REST 请求时遇到问题。调用服务时丢失了一些参数。但是当我以 xml 格式发送请求时它工作正常。我的问题得到以下错误:
SEVERE: The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "create_session_param"
对象映射器类如下所示:
objectMapper = new ObjectMapper();
objectMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,true);
JaxbAnnotationModule module = new JaxbAnnotationModule();
// maintain JAXB annotation support
objectMapper.registerModule(module);
有人可以帮我解决这个问题吗?
谢谢。
【问题讨论】:
-
您能否提供您尝试序列化的类(无论如何是相关部分)以及您尝试解析的 JSON 示例?
-
@AlexTaylor 我已经更新了问题。你能帮忙吗。
标签: json rest jersey jackson jax-rs