This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

RestClientException:Cannot extract response: no Content-Type found

Oct 8th, 2012, 06:59 AM

We are using Spring 3.1.2.We have some REST web services which produce JSON reponse.We are using Spring REST Template to consume the service.

But randomly ,5-10% requests are randomly giving the exception:Cannot extract response: no Content-Type found in ResTemplate exchange method.It is totally random ,there is no pattern.HTTPMonitor shows that whenwe are getting the exception, the content type in response header is not set by the service.

org.springframework.web.client.RestClientException : Could not extract response: no suitable HttpMessageConverter found for response type [org.onesync.common.dto.uma.UserDTO] and content type [application/octet-stream]
at org.springframework.web.client.HttpMessageConverte rExtractor.extractData(HttpMessageConverterExtract or.java:84)
at org.springframework.web.client.RestTemplate$Respon seEntityResponseExtractor.extractData(RestTemplate .java:627)
at org.springframework.web.client.RestTemplate$Respon seEntityResponseExtractor.extractData(RestTemplate .java:1)
at org.springframework.web.client.RestTemplate.doExec ute(RestTemplate.java:454)
at org.springframework.web.client.RestTemplate.execut e(RestTemplate.java:409)
at org.springframework.web.client.RestTemplate.exchan ge(RestTemplate.java:385)
at org.onesync.pdm.uma.user.main.NextGenServicesClien tMain.getUser(NextGenServicesClientMain.java:58)
at org.onesync.pdm.uma.user.main.NextGenServicesClien tMain.main(NextGenServicesClientMain.java:46)