No suitable HttpMessageConverter found when trying to execute restclient request
android, java
Solution
There could be a few different reasons why this can happen. In my case, i had the RestTemplate already wired in, but still got this error. Turns out, i had to add a dependency on "jackson-databind":
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
Problem
I'm trying to use `Spring for Android rest client` to send data with an `http post` , to avoid creating and parsing the json data. From their manual they have the following method: ``` restTemplate.postForObject(url, m, String.class) ``` After the method is called I get the following exception: ``` No suitable HttpMessageConverter found when trying to execute restclient request ``` My activity code snippet is : ``` RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().add(new MappingJacksonHttpMessageConverter()); restTemplate.getMessageConverters().add(new StringHttpMessageConverter()); Message m = new Message(); m.setLibrary("1"); m.setPassword("1395"); m.setUserName("1395"); String result = restTemplate.postForObject(url, m, String.class); ``` And the Message object is : ``` public class Message { private String UserName, Password, Library; public String getUserName() { return UserName; } public void setUserName(String userName) { UserName = userName; } public String getPassword() { return Password; } public void setPassword(String password) { Password = password; } public String getLibrary() { return Library; } public void setLibrary(String library) { Library = library; } } ``` Why can't it `convert the Message object to JSON` ?