users@jersey.java.net

Won't work in servlet.

From: Justin Ransom Dallas <justindallas_at_gmail.com>
Date: Tue, 21 Sep 2010 07:50:16 -0400

Hello Everyone ,
   I am using Jersey as a REST client in a Glassfish v3 server. When I run
the client from a servlet I seem to always get this error no matter what I
do , however if I run it from a Main file , it works like a charm. Does
anyone know what the problem could be ? I am using Jersey core 1.5

WARNING: StandardWrapperValve[CreditServlet]: PWC1406: Servlet.service() for
servlet CtServlet threw exception
java.lang.AbstractMethodError
at
com.sun.jersey.core.spi.factory.MessageBodyFactory._getMessageBodyReader(MessageBodyFactory.java:229)
at
com.sun.jersey.core.spi.factory.MessageBodyFactory.getMessageBodyReader(MessageBodyFactory.java:215)
...
ClientConfig config = new DefaultClientConfig();
Client client = Client.create(config);
WebResource webResource = client.resource("https://someurl.com");

ClientResponse response2 =
webResource.path("/somepath").get(ClientResponse.class);
System.out.println( response2.getStatus() );
System.out.println( response2.getHeaders().get("Content-Type") );
String entity = response2.getEntity(String.class);
System.out.println(entity);