日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

解决——》feign文件下载时报错feign.codec.EncodeException: not in non blocking mode

發布時間:2023/12/18 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 解决——》feign文件下载时报错feign.codec.EncodeException: not in non blocking mode 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

推薦鏈接:
????總結——》【Java】
????總結——》【Mysql】
????總結——》【Spring】
????總結——》【SpringBoot】
????總結——》【MyBatis、MyBatis-Plus】

解決——》feign文件下載時報錯feign.codec.EncodeException: not in non blocking mode

  • 1、操作
  • 2、現象
  • 3、原因
  • 4、解決

1、操作

feign文件下載

2、現象

報異常feign.codec.EncodeException: not in non blocking mode

2022-11-10 09:30:05.200 ERROR [10.122.143.9] [http-nio-8882-exec-2] [house-platform-api-0a7a8f09-463345-253] com.eju.houseparent.config.starter.BaseControllerHandler.handleException [line=143 ] : handleException ex uri:/tmall/cityopen/syncEsfCommunity/logList/downloadError/1667895255597,param:{} 2022-11-10 09:30:05.200 ERROR [10.122.143.9] [http-nio-8882-exec-2] [house-platform-api-0a7a8f09-463345-253] com.eju.houseparent.config.starter.BaseControllerHandler.handleException [line=144 ] : handleException ex class:class feign.codec.EncodeException,ex:not in non blocking mode. 2022-11-10 09:30:05.201 ERROR [10.122.143.9] [http-nio-8882-exec-2] [house-platform-api-0a7a8f09-463345-253] com.eju.houseparent.config.starter.BaseControllerHandler.handleException [line=145 ] : 系統正在維護中,請稍候再試 feign.codec.EncodeException: not in non blocking mode.at feign.ReflectiveFeign$BuildEncodedTemplateFromArgs.resolve(ReflectiveFeign.java:384)at feign.ReflectiveFeign$BuildTemplateByResolvingArgs.create(ReflectiveFeign.java:232)at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:84)at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:100)at com.sun.proxy.$Proxy305.downloadErrorLogListByBatchNo(Unknown Source)at com.ejudata.platform.controller.TmallCityOpenController.downloadErrorLogListByBatchNo$original$DkyYi2Ll(TmallCityOpenController.java:70)at com.ejudata.platform.controller.TmallCityOpenController.downloadErrorLogListByBatchNo$original$DkyYi2Ll$accessor$nvaSjmiZ(TmallCityOpenController.java)at com.ejudata.platform.controller.TmallCityOpenController$auxiliary$m4Yk46Iz.call(Unknown Source)at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:86)at com.ejudata.platform.controller.TmallCityOpenController.downloadErrorLogListByBatchNo(TmallCityOpenController.java)

3、原因

服務消費者,需要設置方法返回值為Response

4、解決

將服務提供者的文件下載響應的響應體(文件內容)復制到服務消費者對外的文件下載響應體中

@FeignClient(value = "${feign.client.config.good-house-push.name}", url = "${feign.client.config.good-house-push.url}", path = "${feign.client.inner.path}", configuration = CatFeignConfiguration.class) public interface ITmallSyncEsfCommunityApi{@ApiOperation("根據批次號,下載同步二手房小區的錯誤日志列表")@GetMapping({"/api/tmall/syncEsfCommunity/logList/downloadError/{batchNo}"})Response downloadErrorLogListByBatchNo(@PathVariable(name = "batchNo") String batchNo); } @ApiOperation(value = "根據批次號,下載同步二手房小區的錯誤日志列表")@GetMapping("/cityopen/syncEsfCommunity/logList/downloadError/{batchNo}")void downloadErrorLogListByBatchNo(@PathVariable(name = "batchNo") String batchNo, HttpServletResponse response) {InputStream inputStream = null;try {Response serviceResponse = tmallSyncEsfCommunityApi.downloadErrorLogListByBatchNo(batchNo);Response.Body body = serviceResponse.body();inputStream = body.asInputStream();BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");response.setCharacterEncoding("utf-8");response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + batchNo + ".xlsx");BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(response.getOutputStream());int length = 0;byte[] temp = new byte[1024 * 10];while ((length = bufferedInputStream.read(temp)) != -1) {bufferedOutputStream.write(temp, 0, length);}bufferedOutputStream.flush();bufferedOutputStream.close();bufferedInputStream.close();inputStream.close();} catch (IOException e) {e.printStackTrace();}}

總結

以上是生活随笔為你收集整理的解决——》feign文件下载时报错feign.codec.EncodeException: not in non blocking mode的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。