I use Maven + Spring 4.1.0 + Java 6 and I want use RestTemplate().postForEntity(url, request, responseType)
while I execute this code :
HttpEntity<MultiValueMap<String, Object>> entity = new HttpEntity<MultiValueMap<String, Object>>(parameters, headers);
final RestTemplate restTemplate = RestTemplateUtils.createHttpTemplate();
ResponseEntity<String> response = restTemplate.postForEntity(url, entity,
String.class);
but I have this error:
org.springframework.http.converter.HttpMessageNotWritableException: Could not write request: no suitable HttpMessageConverter found for request type [java.util.HashMap] at org.springframework.http.converter.FormHttpMessageConverter.writePart(FormHttpMessageConverter.java:310) at org.springframework.http.converter.FormHttpMessageConverter.writeParts(FormHttpMessageConverter.java:270) at org.springframework.http.converter.FormHttpMessageConverter.writeMultipart(FormHttpMessageConverter.java:260) at org.springframework.http.converter.FormHttpMessageConverter.write(FormHttpMessageConverter.java:200) at org.springframework.http.converter.FormHttpMessageConverter.write(FormHttpMessageConverter.java:1) at org.springframework.web.client.RestTemplate$HttpEntityRequestCallback.doWithRequest(RestTemplate.java:596) at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:444) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:409) at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:310)
The problem was due to old spring Version, so needed to migrate to Spring version 4, and the problem was solved.