Search code examples
resttemplate

Error while extracting response for type [class java.lang.Object] and content type [text/html;charset=utf-8]


while calling rest template getting below exception ,can anyone tell how to parse html content ?

org.springframework.web.client.RestClientException: Error while extracting response for type [class java.lang.Object] and content type [text/html;charset=utf-8]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null'); nested exception is com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: (PushbackInputStream); line: 1, column: 2]


Solution

  • it Worked, List> messageConverters = new ArrayList>();
    ResourceHttpMessageConverter converter = new ResourceHttpMessageConverter();

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