no suitable HttpMessageConverter found for response type 异常
报错:
org.springframework.web.client.RestClientException:
Could not extract response: no suitable HttpMessageConverter found for response type [...]
and content type [text/html;charset=utf-8]
解决办法:
HttpHeaders headers = new HttpHeaders();headers.add("Content-Type", "text/html;charset=utf-8");HttpEntity requestEntity=new HttpEntity<>(headers);RestTemplate restTemplate = getRestTemplate(timeOut);MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();converter.setSupportedMediaTypes(Arrays.asList(MediaType.ALL));restTemplate.getMessageConverters().add(0, converter);ResponseEntity baseResultVOResponseEntity = restTemplate.exchange(url,HttpMethod.POST,requestEntity,//返回值类型new ParameterizedTypeReference<ResponseDTO<SomeResponseDTO>>() {});}private static RestTemplate getRestTemplate(Integer timeout) {SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();requestFactory.setConnectTimeout(timeout);return new RestTemplate(requestFactory);}
no suitable HttpMessageConverter found for response type 异常相关推荐
- restTemplate http请求报错:no suitable HttpMessageConverter found for response type and content type
报错信息: org.springframework.web.client.UnknownContentTypeException: Could not extract response: no sui ...
- Could not extract response: no suitable HttpMessageConverter found for response type [class java.lan
解决 Could not extract response: no suitable HttpMessageConverter found for response type [class java. ...
- 小小涉及OpenFeign原理:Could not extract response: no suitable HttpMessageConverter found for response type
一.问题解释(想看总结的去最下面) org.springframework.web.client.UnknownContentTypeException: Could not extract resp ...
- Could not extract response: no suitable HttpMessageConverter found for response type [class com.exam
报错信息:Could not extract response: no suitable HttpMessageConverter found for response type [class com ...
- RestTemplate请求Could not extract response: no suitable HttpMessageConverter found for response type..
使用 Spring Boot 写项目,需要用到微信接口获取用户信息. 在 Jessey 和 Spring RestTemplate 两个 Rest 客户端中,想到尽量不引入更多的东西,然后就选择了 S ...
- Could not extract response: no suitable HttpMessageConverter found for response type ***
用RestTemplate.getForObject()获取URL的JSON时,可能会遇到如题所示的报错信息. 我的问题在于:在非MVC的Project中使用RestTemplate. 简单的说,me ...
- openFeig远程调用报错Could not extract response: no suitable HttpMessageConverter found for response type
解决方案:在调用服务和被调用的服务上都加上一个配置类 @Configuration public class jsonConfig {@Beanpublic HttpMessageConverters ...
- Could not extract response: no suitable HttpMessageConverter found for content type [text/html]
目录 报错信息 源码分析 解决方法 修改 mappingJackson2HttpMessageConverter 配置 继承 mappingJackson2HttpMessageConverter 实 ...
- 使用RestTemplate:报错Could not extract response: no suitable HttpMessageConverter found for response typ
项目中需要调用微信接口获取access_token等一系列和微信接口相关的操作,我使用了Spring自带的RestTemplate类来发送Get或Post请求,直接在Spring配置文件中依赖注入 & ...
- RestTemplate异常no suitable HttpMessageConverter found for request type [java.lang.Integer]
RestTemplate异常no suitable HttpMessageConverter found for request type [java.lang.Integer] 参考文章: (1)R ...
最新文章
- vs2010 使用vs online账号 需要安装的插件
- 斯诺登称美向日提供监控系统 日本人或遭大规模监控
- Angular 运行报错 RouterModule.forRoot() called twice.
- java优先级对接_Java对接硬件接口,采用Scoket连接,数据报文通信
- linux cpu平均负载,关于linux系统CPU篇---平均负载
- 2018年终总结以及未来展望
- v4l2接口,结构图
- 以太坊 solidity 教程
- 【磨刀不误砍柴工】由传递函数绘出频率响应图
- HTTP代理模式学习
- 生成对抗网络训练_生成对抗网络
- case when 嵌套
- 【软件工程】决策表和决策树
- ST-LINK Utility + ST LINK+ STM32G474 erase chip fails
- Google SEO 搜索中心
- 【转载】Sftp搭建与配置
- MaxCompute_概念/使用
- 多线程 - 三种实现
- wince5.0模拟器连接ActiveSync和共享网络PC分享上网及运行BS程序(模拟手持设备)
- 01_李宏毅机器学习
热门文章
- VNC源码研究(二十四)vnc-4.0-winsrc版本之winvnc工程分析
- 今日头条 2018 AI Camp 视频面试
- 白山搜索引擎优化收费_百度搜索引擎优化收费标准
- SSL2706 2017年8月17日提高组T2 考试(贪心)
- 计算机专业职业理想作文400字,我的理想作文400字(精选4篇)
- gromacs ngmx_GROMACS使用教程要点
- 华为员工工资曝光:入职12年月薪31万!手里的窝窝头突然就不香了.....
- 实战开发支付SDK —— 对接微信支付看这一篇文章就够啦(含源码)
- wordpress 瀑布流ajax,WordPress瀑布流主题:蛋花儿Free版
- TPshop项目(三)