但行好事
莫论前程❤

Jackson反序列化异常

com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of com.feinno.perftrace.web.vo.ServerInfo: no suitable constructor found, can not deserialize from Object value (missing default constructor or creator, or perhaps need to add/enable type information?)
 at [Source: [{"agentId":"portal-web-01","applicationName":"BI-Portal-Web","hostName":"OP-APM-05","ip":"192.168.251.215","agentVersion":"1.1.0","status":"Shutdown","eventTimestamp":1524630056108},{"agentId":"report-web-01","applicationName":"BI-Report-Web","hostName":"OP-APM-06","ip":"192.168.251.216","agentVersion":"1.1.0","status":"Running","eventTimestamp":1527216694004},{"agentId":"bi-core-api","applicationName":"BI-CORE-API","hostName":"OP-APM-03","ip":"192.168.156.103","agentVersion":"1.1.0","status":"Running","eventTimestamp":1527216693845},{"agentId":"bi-query-api","applicationName":"BI-BackEnd-API","hostName":"OP-APM-04","ip":"192.168.156.104","agentVersion":"1.1.0","status":"Running","eventTimestamp":1527216693863},{"agentId":"dubbo-web-01","applicationName":"BI-Dubbo-Web","hostName":"OP-APM-01","ip":"192.168.156.101","agentVersion":"1.1.0","status":"Running","eventTimestamp":1527216693863}]; line: 1, column: 3] (through reference chain: java.util.ArrayList[0])
    at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:270)
    at com.fasterxml.jackson.databind.DeserializationContext.instantiationException(DeserializationContext.java:1456)
    at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1012)

原因反序列化时mapper会先调用对象的默认构造方法进行初始化,如果没有定义无参构造的话,就会报此错

赞(0) 打赏
未经允许不得转载:刘鹏博客 » Jackson反序列化异常
分享到: 更多 (0)

评论 抢沙发

评论前必须登录!

 

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏