I am getting no suitable HttpMessageConverter found error only on AWS, where as it is working perfect on Cloud Foundry and I'm getting the response.
Do I need to make any special configuration for RestTemplate in order to work on AWS?
Configuration class
@Configuration
public class RestTemplateConfiguration {
@Bean
RestTemplate restTemplate() {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setOutputStreaming(false);
RestTemplate restTemplate = new RestTemplate(requestFactory);
restTemplate.setErrorHandler(new RestResponseErrorHandler());
return restTemplate;
}
}
Client class
@Component
public class RestClient {
private final RestTemplate restTemplate;
@Autowired
public RestClient(RestTemplate restTemplate) {
this.restTemplate = restTemplate;
}
public ResponseObj getData() {
return restTemplate.postForObject("http://somehost:port/data", requestObj, ResponseObj.class);
}
}
both requestObj and ResponseObj classes are POJO classes.
Error:
{
"timestamp": 1471491645132,
"status": 500,
"error": "Internal Server Error",
"exception": "org.springframework.web.client.RestClientException",
"message": "Could not extract response: no suitable HttpMessageConverter found for response type [class com.bosch.lui.connectservice.model.poi.response.PoiResponse] and content type [text/html;charset=iso-8859-1]",
"path": "/lui/v1/omni/pois/search"
}