users@jersey.java.net

[Jersey] Re: Premature EOF on clientResponse.getEntity()

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Wed, 03 Aug 2011 10:37:10 +0200

Check your serviceUrl content. It may not be pointing at your deployed resource. Also check that your resource is
deployed and available.

Without the exception stacktrace and a reproducible test case it's hard to give more advice.

Marek

On 08/02/2011 06:44 PM, Pascal Huynh wrote:
> Hello all,
>
> I'm stuck on a problem with the use of the jersey client API and I don't find any helpfull tip on the web.
> Here my problem :
>
> I've a simple resource producing json :
>
> @Path("/myresource")
> @Produces(MediaType.APPLICATION_JSON)
> public class MyResource {
>
> @GET
> @Path("/documents/info")
> public String getInfo() {
> return "Something";
> }
> }
>
>
> and simple client requesting this resource :
>
> public String getInfo() {
> WebResource resource = client.resource(serviceUrl + "/documents/info");
> return resource.get(String.class);
> }
>
> This cause an IOexception ; Premature EOF
>
> I feel really stupid with code as simple but I can not find any solution. (using a ClientResponse instance goes same way).
>
> Any help would be very appreciated!!
>
> Thanks a lot
>