users@jersey.java.net

[Jersey] Consume Json Jersey Response

From: Colin Vipurs <zodiaczx6_at_gmail.com>
Date: Fri, 18 Mar 2011 09:18:18 +0000

Hi all,

This feels like a stupid thing to ask, but I haven't found an answer
yet. I have a service for which I expose a client JAR containing all
classes that are marshalled through my exposed Json endpoint. I
thought (and fairly sure that I'd tested) that all someone needed was
the jersey-client dependency and they could automagically convert the
json response into an object hierarchy.

What I thought we could do is....

                SearchResults results =
client.resource(UriBuilder.fromPath("http://searchhost/search")
                                .path(SearchType.WEB.toString().toLowerCase())
                                .path(SearchDomain.ALL.toString())
                                .path("tigertailz").build()).get(SearchResults.class);

But we get the error.,.

Exception in thread "main"
com.sun.jersey.api.client.ClientHandlerException: A message body
reader for Java class SearchResults, and Java type class
SearchResults, and MIME media type application/json was not found.

The dev working on this says he's followed all kinds of tutorials and
nothing works. This seems like we're missing something very simple -
can someone put us on the right path?



-- 
Maybe she awoke to see the roommate's boyfriend swinging from the
chandelier wearing a boar's head.
Something which you, I, and everyone else would call "Tuesday", of course.