feign遇到的问题

调用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失败解决办法

你可能感兴趣的:(java)