Cannot deserialize instance of out of START_ARRAY token

昨天晚上临下班前写了一个内部调用接口,在调用时发现了报了以下错误

Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of  out of START_ARRAY token

项目使用了Feign框架,,在被调用方看起来是正常。。被调用方controller层详细代码如下:

@Inner
	@PostMapping("/getPileInfoList")
	public R getPileInfoList(@RequestParam(value = "agentId",required = false) Long agentId,@RequestParam(value = "stationId",required = false) Long stationId,@RequestParam(value = "interconnectionFlag",required = false) Long interconnectionFlag){
		R result = new R();
		try {
			result.setData(pileService.list(queryEntity));
			return result;
		}catch (Exception e){
			log.error("查询不携带枪信息的桩信息失败:{}",e);
			return result.setError(ResponseTypeEnum.GLOBAL_REQUEST_FAILED);
		}
	}

被远程调用方的开放service如下:

/**
	  * @description: 查询桩信息列表不包含枪信息
	  * @param
	  * @return
	  * @throws
	  * @author ckinghan
	  * @date 2020/5/6 18:33
	 */
	@PostMapping("/app/getPileInfoList")
	R<PileListVo> getPileInfoList(@RequestParam(value = "agentId",required = false) Long agentId,@RequestParam(value = "stationId",required = false) Long stationId,@RequestParam(value = "interconnectionFlag",required = false) Integer interconnectionFlag, @RequestHeader(SecurityConstants.FROM) String from);

经详细分析了一下错误信息及调用代码,发现在远程调用响应类中,添加响应泛型为:PileListVo,而实际我在响应时并没有返回这个泛型,响应的实际泛型是List,好吧。。更改被调用controller层代码如下:

    @Inner
	@PostMapping("/getPileInfoList")
	public R getPileInfoList(@RequestParam(value = "agentId",required = false) Long agentId,@RequestParam(value = "stationId",required = false) Long stationId,@RequestParam(value = "interconnectionFlag",required = false) Long interconnectionFlag){
		R result = new R();
		try {
			PileListVo listVo = new PileListVo();
			listVo.setPileEntityList(pileService.list(queryEntity));
			result.setData(listVo);
			return result;
		}catch (Exception e){
			log.error("查询不携带枪信息的桩信息失败:{}",e);
			return result.setError(ResponseTypeEnum.GLOBAL_REQUEST_FAILED);
		}
	}

更改后问题解决。。
不细心造成的问题,,浪费近20分钟时间 !(¥……¥)!

留个记录,如果有出现相同问题的朋友可以做个参考。。

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值