Feign接口调用错误信息

feign.codec.DecodeException: Error while extracting response for type [java.util.List<org.xxx.xxx.system.api.entity.xxx>] and content type [application/json]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize instance of `java.util.ArrayList<org.xxx.xxx.system.api.entity.xxx>` out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.ArrayList<org.xxx.xxx.system.api.entity.xxx>` out of START_OBJECT token
 at [Source: (PushbackInputStream); line: 1, column: 1]
。。。
Caused by: org.springframework.web.client.RestClientException: Error while extracting response for type java.util.ArrayList<org.xxx.xxx.system.api.entity.xxx>`  and content type [application/json]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: Invalid JSON input: Cannot deserialize instance of `com.yxkj.netplus.yxdllapi.response.MzNoPayResponse` out of START_ARRAY token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `com.yxkj.netplus.yxdllapi.response.MzNoPayResponse` out of START_ARRAY token
 at [Source: (PushbackInputStream); line: 1, column: 244] (through reference chain: com.yxkj.netplus.netcore.result.Result["data"])
 
Caused by: org.springframework.http.converter.HttpMessageNotReadableException: Invalid JSON input: Cannot deserialize instance of java.util.ArrayList<org.xxx.xxx.system.api.entity.xxx>`  out of START_ARRAY token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `com.yxkj.netplus.yxdllapi.response.MzNoPayResponse` out of START_ARRAY token
 at [Source: (PushbackInputStream); line: 1, column: 244] (through reference chain: com.yxkj.netplus.netcore.result.Result["data"])
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of java.util.ArrayList<org.xxx.xxx.system.api.entity.xxx>` out of START_ARRAY token
 at [Source: (PushbackInputStream); line: 1, column: 244] (through reference chain: com.yxkj.netplus.netcore.result.Result["data"])
	at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)

问题原因:
在调用时返回值是Result 无法解析json错误说明返回值是出现错误
提供接口错误位置

@GetMapping("/rightHolderTree")
    public Result rightHolderTree( @RequestParam Map<String, Object> params) {
        if (StringUtils.isEmpty(params.get("Id").toString())) {
            params.put("Id", null);
        } else {
            params.put("Id", ShiroUtil.getLoginUser().getId());
        }
        List<xxx> tree = RightHolderService.queryRightHolderTree(params);
        return Result.OK(tree);
    }

修改后:

@GetMapping("/rightHolderTree")
    public  Result<List<xxx>> rightHolderTree( @RequestParam Map<String, Object> params) {
        return Result.OK();
    }

Feign的调用接口:

 @GetMapping("/sys/api/rightHolderTree")
    Result<List<xxx>> rightHolderTree(@RequestParam Map<String, Object> params) ;

主要原因是出现在泛型上对应得实体类要有无参构造器。

希望会对出现一样的问题的您有帮助。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值