0

I am getting the below error while hitting the rest service from jersey client>

javax.ws.rs.ProcessingException: java.net .SocketException: Unexpected end of file from server at
org.glassfish.jersey.client.HttpUrlConnector.apply(HttpUrlConnector.java:229) at
org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:246) at
org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:667) at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:664) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:297) at org.glassfish.jersey.internal.Errors.process(Errors.java:228) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java: 443) at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:664) at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.jav a:424) at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:333)

Jeff
  • 9,076
  • 1
  • 19
  • 20
  • Possible duplicate of [Java simple code: java.net.SocketException: Unexpected end of file from server](http://stackoverflow.com/questions/19824339/java-simple-code-java-net-socketexception-unexpected-end-of-file-from-server) – Meiko Rachimow Mar 23 '16 at 08:12
  • Hello Meiko, I read this post before posting this question. It was not helpful for me. i checked the server log too, Everything is fine there. Also the same URL is working fine with rest client tools ( Fiddler, Advanced Rest Client, Postman etc). The problem is coming while using jersey client to send the request. ( Sometimes, result is coming as expected, while some time it gives this exception ). Also, the URL is having special character in pathParam value, – Kartik Agrawal Mar 24 '16 at 14:19
  • hi, i think the marked answer is matching here too... any other information than the error in your question could help. – Meiko Rachimow Mar 24 '16 at 14:22
  • Hello Meiko, Sorry for too late to post here.. But, the problem still persists. I am unable to figure out the cause.. Other information is that, I get this exception only for invalid urls, ie I am validating the 404 response as part of my functional testing. Below is the line of code in which request hangs sometimes and gives the EOF exception. Response res = requestbuilder.post( Entity.entity( multipart, multipart.getMediaType() ) ); – Kartik Agrawal May 27 '16 at 18:01

1 Answers1

0

when using javax.ws.core.Response it needs to call close() after consumption of the response. just double check somewhere there is no leak regarding http connection.

https://github.com/docker-java/docker-java/issues/110

http://phillbarber.blogspot.de/2014/02/lessons-learned-from-connection-leak-in.html

yantaq
  • 3,968
  • 2
  • 33
  • 34