Skip to main content

How to retrieve a List with all the entities in a database table

No replies
Joined: 2008-12-26


I have developed a RESTful WS and then the corresponding client and here is where I have got the problem.

Prueba (Try) is the only entity I use in this WS. It is every row in the database table.

This is my code,

public JerseyClient() {
com.sun.jersey.api.client.config.ClientConfig config = new com.sun.jersey.api.client.config.DefaultClientConfig();
client = Client.create(config);
webResource = client.resource(BASE_URI).path("pruebas");

this is the constructor of the client. And I get the list of entities as follows,

public List getPruebas() {

List pruebas = new ArrayList();

// 2, get response and headers etc, wrapped in ClientResponse
GenericType> genericType = new GenericType>() {};
pruebas = webResource.get(genericType);

return pruebas;

It is based on the question answered by Paul Sandoz at,

but my code does not work. I get the following error,

org.apache.jasper.JasperException: com.sun.jersey.api.client.ClientHandlerException: A message body reader for Java type, interface java.util.List, and MIME media type, application/xml, was not found

Any help or suggestion will be appreciated.