提取类型[class java.lang.Object]和内容类型[text / html; charset = utf-8]的响应时出错

时间:2019-12-12 04:55:19

标签: resttemplate

在调用rest模板低于异常时,有人能告诉我如何解析html内容吗?

org.springframework.web.client.RestClientException:提取类型[class java.lang.Object]和内容类型[text / html; charset = utf-8]的响应时出错;嵌套的异常是org.springframework.http.converter.HttpMessageNotReadableException:JSON解析错误:意外的字符(“ <”(代码60)):预期的有效值(数字,字符串,数组,对象,“真”,“假”或'空值');嵌套异常是com.fasterxml.jackson.core.JsonParseException:意外字符(“ <”(代码60)):预期为有效值(数字,字符串,数组,对象,“真”,“假”或“空”)  在[来源:(PushbackInputStream);行:1,列:2]

1 个答案:

答案 0 :(得分:0)

成功了, List> messageConverters = new ArrayList>();
ResourceHttpMessageConverter转换器=新的ResourceHttpMessageConverter();

messageConverters.add(converter);                         restTemplate.setMessageConverters(messageConverters);