users@jersey.java.net

Re: [Jersey] How to retrieve a List<> with all the entities in a database table

From: Martin Matula <Martin.Matula_at_Sun.COM>
Date: Sun, 12 Sep 2010 00:28:51 +0200

Hi Jose,
Is "Prueba" a JAXB bean (i.e. is it annotated with @XmlRootElement)?
(see https://jersey.dev.java.net/nonav/documentation/1.4-SNAPSHOT/xml.html
#d0e1800)
In case you are using an older version of Jersey with JDK 5, do you
have jaxb jars on your classpath?
Martin

On Sep 11, 2010, at 7:23 PM, Jose Alvarez de Lara wrote:

> Hi,
>
> 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<Prueba> getPruebas() {
>
> List<Prueba> pruebas = new ArrayList<Prueba>();
>
> // 2, get response and headers etc, wrapped in ClientResponse
> GenericType<List<Prueba>> genericType = new
> GenericType<List<Prueba>>() {};
> pruebas = webResource.get(genericType);
>
> return pruebas;
> }
>
> It is based on the question answered by Paul Sandoz at,
>
> http://jersey.576304.n2.nabble.com/How-can-I-parse-a-java-util-List-Is-it-supported-by-the-Jersey-client-td2300852.html
>
> 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.
>
> Regards,
> Jose