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 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分钟时间 !(¥……¥)!

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

你可能感兴趣的:(springCloud)