在使用 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. SAAS多租户数据逻辑隔离

    基于Mybatis 的SAAS应用多租户数据逻辑隔离 package com.opencloud.common.interceptor;import org.apache.commons.lang3. ...

  2. MySQL解决忘记密码问题

    解决Win10下Mysql 的Access denied for user'root'@'localhost' (using password: NO)问题 mysql一旦忘记密码即会出现这样的错误. ...

  3. AOS and clustering

    原文转载:http://sjakalax.blogspot.com/2010/10/aos-and-clustering.html AOS and clustering   hi,   There s ...

  4. 线程局部变量ThreadLocal实现原理

    ThreadLocal,即线程局部变量,用来为每一个使用它的线程维护一个独立的变量副本.这种变量只在线程的生命周期内有效.并且与锁机制那种以时间换取空间的做法不同,ThreadLocal没有任何锁机制 ...

  5. 手机端 css 样式重置

    @charset "utf-8"; body, div, ul, li, ol, h1, h2, h3, h4, h5, h6, input, textarea, select, ...

  6. How to Add Memory, vCPU, Hard Disk to Linux KVM Virtual Machine

    ref: https://www.thegeekstuff.com/2015/02/add-memory-cpu-disk-to-kvm-vm/ In our previous article of ...

  7. Java中数组在内存中的存放原理?

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/yangyong0717/article/details/79165685Java中数组被实现为对象, ...

  8. shell 操作mysql

    1.连接 #!/bin/bash user="root" password="XXXXXX" sql = `mysql -u>/dev/null use ...

  9. redis专题

    1.Linux安装redis 2.redis持久化 3.redis配置 4.SpringBoot整合Redis发布订阅 5.redis事务 5.1.redis事务介绍 5.2. redisTempla ...

  10. python语句执行

    python文件中的语句,按顺序执行,执行import时,原文件会入栈,等import文件执行完成后,才会出栈执行. load/const.py --- import os DB_ADDRESS = ...