在使用 RestTemplate 或者 Spring Cloud 的时候,经常会出现这个错误。

基本上出现的场景都是,我们要json,结果来了个 text/html。

两个原因:

第一个就是:服务器返回的就是 text/html 或者不是你要的格式,那么就需要修改 HttpMessageConverter 增加格式类型。

      一般这种情况都是请求别人的服务器。

第二种就是:这种是莫名其妙出现的这个错误,请求的是自己的服务器,或者明知服务器返回的是json格式,却还出现这个错误。

      显示返回了 text/html 格式。那就是请求出现了错误,比如400,403,500。这样返回的都不是json,却是text/html。

no suitable HttpMessageConverter found for response type的更多相关文章

  1. no suitable HttpMessageConverter found for request type [java.lang.Integer]

    今天在使用Spring Template的时候遇到了这个异常: no suitable HttpMessageConverter found for request type [java.lang.I ...

  2. RestTemplate异常no suitable HttpMessageConverter found for request type [java.lang.Integer]

    GET方式,参数必须放在URL后面,http://xxx/list?name={name}&age={age} package com.chelizi.xiruo.xframework.uti ...

  3. RestTemplate HttpMessageConverter报错的解决方案no suitable HttpMessageConverter

    错误 no suitable HttpMessageConverter found for response type and content type [text/html;charset=UTF- ...

  4. 【FAQ】Could not extract response: no suitable HttpMessageConverter found for respo

    原因: 1:某些必须传入的参数没传 2:返回对象的接收类型不一致

  5. RestTemplate 微信接口 text/plain HttpMessageConverter

    一.背景介绍 使用 Spring Boot 写项目,需要用到微信接口获取用户信息. 在 Jessey 和 Spring RestTemplate 两个 Rest 客户端中,想到尽量不引入更多的东西,然 ...

  6. Androidannotation使用之@Rest与server交互的JSON数据转换(二)

    开篇 之前的一篇博客:Androidannotation使用之@Rest获取资源及用户登录验证(一):http://blog.csdn.net/nupt123456789/article/detail ...

  7. Spring Boot使用RestTemplate消费REST服务的几个问题记录

    我们可以通过Spring Boot快速开发REST接口,同时也可能需要在实现接口的过程中,通过Spring Boot调用内外部REST接口完成业务逻辑. 在Spring Boot中,调用REST Ap ...

  8. 004-RestTemplate 使用常见问题

    一.使用 同前三节:ClientGetGoodsByGoodsIdResponse response = restTemplate.postForObject(svcUrl, request, Res ...

  9. RestTemplate 使用中的几个问题

    Spring Boot使用RestTemplate消费REST服务的几个问题记录 我们可以通过Spring Boot快速开发REST接口,同时也可能需要在实现接口的过程中,通过Spring Boot调 ...

随机推荐

  1. echart 属性设计大全

    // 全图默认背景  // backgroundColor: ‘rgba(0,0,0,0)’, // 默认色板 color: ['#ff7f50','#87cefa','#da70d6','#32cd ...

  2. 移动端300ms延迟原理,穿透、遮罩层滑动导致下面滑动总结

    遮罩层滑动导致下面滑动 1,阻止弹层滑动,使用默认事件,使用这种方式弹层不能滑动 document.getElementById("model").addEventListener ...

  3. nginx报错[error] CreateFile() "D:\Java-windows\nginx-1.16.0/logs/nginx.pid" failed (2: The system cannot find the file specified)

    无论是nginx -s stop还是nginx -s reload命令,都会出现这个错误. 解决方法:使用命令创建/logs/nginx.pid文件,命令如下所示: nginx -c conf/ngi ...

  4. python基础--4 元祖

    #元组,元素不可被修改,不能被增加或者删除 #tuple,有序 tu=(11,22,33,44,55,33) #count 获取指定元素在元祖中出现的次数 print(tu.count(33)) #i ...

  5. windows下laravel 快速安装

    1. 安装composer  https://getcomposer.org/ 2. 安装git windows 客户端工具 https://git-scm.com/downloads 3. 更改co ...

  6. 《Webkit技术内幕》之页面渲染过程

    文章同步到github<Webkit技术内幕>之页面渲染过程 最近拜读了传说中的<Webkit技术内幕>一书,有很大收获,尤其是对页面渲染有了较深的认识.由于功力有限,而且书中 ...

  7. 【leetcode】1090. Largest Values From Labels

    题目如下: We have a set of items: the i-th item has value values[i] and label labels[i]. Then, we choose ...

  8. Django2 + python3 上传图片

    . ├── db.sqlite3 ├── manage.py ├── myImg │   ├── __init__.py │   ├── __pycache__ │   │   ├── __init_ ...

  9. Strassen __128int

    题目链接 题意思路很简单,递归求最小就好了.但__128int没见过.故写博客记下.__128int如果输入输出就要自己写函数. #include<bits/stdc++.h> using ...

  10. 学习日记9、easyui控件两次请求服务器端问题

    <select id="BankCard" class="easyui-combobox" style="width: 600px;" ...