【feign】Could not write request: no suitable HttpMessageConverter found for request type

简介: 【feign】Could not write request: no suitable HttpMessageConverter found for request type

背景


spring程序,使用的feign调用其他服务,结果抛异常:


"Could not write request: no suitable HttpMessageConverter found for request type [com.ekeguan.tradefacade.pojo.req.PhpParams] and content type [application/x-www-form-urlencoded]"}
feign.codec.EncodeException: Could not write request: no suitable HttpMessageConverter found for request type [com.ekeguan.tradefacade.pojo.req.PhpParams] and content type [application/x-www-form-urlencoded]
  at org.springframework.cloud.openfeign.support.SpringEncoder.encode(SpringEncoder.java:151)
  at feign.ReflectiveFeign$BuildEncodedTemplateFromArgs.resolve(ReflectiveFeign.java:380)
  at feign.ReflectiveFeign$BuildTemplateByResolvingArgs.create(ReflectiveFeign.java:232)


看一下报错地方的代码:


    @RequestMapping(value = "/api/distribute/get"
            , consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE
            , method = RequestMethod.POST)
    ApiResponse getOrderExpressList(PhpParams params);


解决方法:


    @Bean
    Encoder feignFormEncoder(ObjectFactory<HttpMessageConverters> converters) {
        return new SpringFormEncoder(new SpringEncoder(converters));
    }
目录
相关文章
|
6月前
|
应用服务中间件 Apache
springmvc中报错Request processing failed;
springmvc中报错Request processing failed;
|
2月前
|
Java API 开发者
【已解决】Spring Cloud Feign 上传文件,提示:the request was rejected because no multipart boundary was found的问题
【已解决】Spring Cloud Feign 上传文件,提示:the request was rejected because no multipart boundary was found的问题
402 0
|
3月前
|
前端开发
Request method ‘POST‘ not supported。 Failed to load resource: net::ERR_FAILED
这篇文章讲述了在前后端分离的项目中,由于前端错误地使用了GET请求方法而不是支持的POST,导致请求被后端拒绝的问题,并提供了相应的解决方法和HTTP方法的CRUD映射知识。
Request method ‘POST‘ not supported。 Failed to load resource: net::ERR_FAILED
|
4月前
|
前端开发 Java Spring
为什么会出现Request method ‘GET‘ not supported`
为什么会出现Request method ‘GET‘ not supported`
874 1
|
6月前
|
应用服务中间件 Apache
消息 Request method ‘POST‘ not supported
消息 Request method ‘POST‘ not supported
|
Java 应用服务中间件 Linux
SpringBoot - Processing of multipart/form-data request failed. Unexpected EOF read on the socket
SpringBoot - Processing of multipart/form-data request failed. Unexpected EOF read on the socket
1529 0
SpringBoot - Processing of multipart/form-data request failed. Unexpected EOF read on the socket
|
Java
【Java异常】Feign常见的坑总结之一:Method Not Allowed“,“message“:“Request method ‘POST‘ not supported“,“path“:“/*
【Java异常】Feign常见的坑总结之一:Method Not Allowed“,“message“:“Request method ‘POST‘ not supported“,“path“:“/*
254 0
|
前端开发 数据库
Failed to load response dataNo data found for resource with given identifier
Failed to load response dataNo data found for resource with given identifier
1570 0
|
Java Android开发
Bad method handle type 7异常解决
在利用androidx版本写demo时,在添加了一些依赖后,遇到了`java.lang.ClassNotFoundException`bug,这就很奇怪了,我就添加rxjava3的依赖,就给我报这个错误。
|
SQL 关系型数据库 MySQL
【解决思路】HTTP Status 500 Type Exception ReportMessage Request processing failed; 【已解决】
经常测试的一个网页,突然报错500。前面也没有发生过,但突然报错,只能先改错了,不然都没法进入页面。为什么会调用到存在bug的语句,而以前没有发生这种情况?这一问题没能想清楚,只能归咎于编译器了。
381 0
【解决思路】HTTP Status 500 Type Exception ReportMessage Request processing failed; 【已解决】