Announcement Announcement Module
No announcement yet.
RestTemplate does not work with spring mvc-ajax sample Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • RestTemplate does not work with spring mvc-ajax sample

    I have had problems using RestTemplate against the spring mvc-ajax sample. My source:

    RestTemplate rest = new RestTemplate();
    AvailabilityStatus l1 = rest.getForObject(
                    AvailabilityStatus.class, "X");
    The exception:

    Exception in thread "main" org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [poc.AvailabilityStatus] and content type [application/json;charset=UTF-8]
    The problem is with the AvailabilityStatus (not having default constructor, etc) - as soon as I replaced AvailabilityStatus with my own domain object on the server and client, everything worked great. I thought I would mention the problem here just in case anyone else hit the same problem.

    I was using 3.0.2.RELEASE on both server and client.