feign遇到的问题

2023-12-21 07:01:14

调用fegin接口报错:

请求地址'/dept/findProjectDept',发生未知异常. org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.lang.RuntimeException: java.io.IOException: UT000036: Connection terminated parsing multipart data

调用代码

@Resource
private UserFeign userFeign; 
 
R projectDept = userFeign.findProjectDept(user.getCompanyId());
    if (projectDept.getCode() != 200) {
        log.error("获取项目信息失败 -> result={}", projectDept);
        throw new ServiceException("获取项目信息失败,请重新尝试");
    }
ProjectDeptVo projectDeptVo = FastjsonUtil.copy(projectDept.getData(), ProjectDeptVo.class);
   

解决方法:

@Value("${lq.getewayIp}")
private String getewayIp;


String result = HttpRequest.get(getewayIp+"/api/user-service/dept/findProjectDept?companyId=" + user.getCompanyId()).execute().body();
    FindPlanListVoSum findPlanListVoSum = new FindPlanListVoSum();
    JSONObject constructionDept = JSONObject.parseObject(result);
    if (constructionDept.getInteger("code") != 200) {
        log.error("获取项目信息失败 -> result={}", constructionDept);
        throw new ServiceException("获取项目信息失败,请重新尝试");
    }
ProjectDeptVo projectDeptVo = FastjsonUtil.copy(constructionDept.getJSONObject("data"), ProjectDeptVo.class);
   

参考文档

io流调用feign失败解决办法_nested exception is java.lang.runtimeexception: ja-CSDN博客 io流调用feign失败解决办法

文章来源:https://blog.csdn.net/weixin_44226752/article/details/135120607
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。