users@jersey.java.net

[Jersey] Re: "Error: Writing to server" - Occuring only on ubuntu

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Mon, 26 Sep 2016 09:05:01 -0700

Hi Pantelis,

this is not a know issue.

Oracle JDK should work, you don't need to consider switching to Open JDK.

We are using linux machines as our test infra, so I'd think this should
be stable and your issue might be related to configuration of your box.
The error you see is not something we can influence form Jersey, seems
like underlying TCP connections is closed at some point and then the
IOException is thrown when the client tries to write into that.

If I were you, I'd try to compare network level config of the windows
machine and the linux box.

Regards,
Pavel


On 26/09/16 08:49, Pantelis Natsiavas wrote:
> Hi everybody.
>
> I am using a jar file implementing custom functionality which uses
> jersey as REST client (version 2.22.1). While everything seems to work
> fine for a few calls, for a specific HTTP call I get a "/Error:
> Writing to server/", but only when running in ubuntu.
>
> The error occurs when running a unit test on my development PC. My
> development PC is an Ubuntu 16.04 with Oracle JDK:
>
> ~$ java -version
> java version "1.8.0_101"
> Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
> Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
>
> Running the same test from a windows machine, gives me no error. On my
> windows machine:
>
> java -version
> java version "1.8.0_102"
> Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
> Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
>
> I can only suppose that the jvm version is the cause of the error. Is
> this a known issue? Does this apply to the ubuntu jvms in general, or
> only to the specific version? Should changing to Open JDK correct the
> error? Could you please provide a hint on how I could avoid this error
> while being on Ubuntu?
>
> The full error's stacktrace is:
> javax.ws.rs <http://javax.ws.rs>.ProcessingException:
> java.io.IOException: Error writing to server
> at org.glassfish.jersey.client.in
> <http://org.glassfish.jersey.client.in>ternal.HttpUrlConnector.apply(HttpUrlConnector.java:287)
> at org.glassfish.jersey.client.Cl
> <http://org.glassfish.jersey.client.Cl>ientRuntime.invoke(ClientRuntime.java:255)
> at org.glassfish.jersey.client.Je
> <http://org.glassfish.jersey.client.Je>rseyInvocation$1.call(JerseyInvocation.java:684)
> at org.glassfish.jersey.client.Je
> <http://org.glassfish.jersey.client.Je>rseyInvocation$1.call(JerseyInvocation.java:681)
> 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:444)
> at org.glassfish.jersey.client.Je
> <http://org.glassfish.jersey.client.Je>rseyInvocation.invoke(JerseyInvocation.java:681)
> at org.glassfish.jersey.client.Je
> <http://org.glassfish.jersey.client.Je>rseyInvocation$Builder.method(JerseyInvocation.java:437)
> at org.glassfish.jersey.client.Je
> <http://org.glassfish.jersey.client.Je>rseyInvocation$Builder.put(JerseyInvocation.java:326)
> ....
> Caused by: java.io.IOException: Error writing to server
> at
> sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:666)
> at
> sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:678)
> at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1534)
> at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
> at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
> at org.glassfish.jersey.client.in
> <http://org.glassfish.jersey.client.in>ternal.HttpUrlConnector._apply(HttpUrlConnector.java:394)
> at org.glassfish.jersey.client.in
> <http://org.glassfish.jersey.client.in>ternal.HttpUrlConnector.apply(HttpUrlConnector.java:285)
> ... 40 more
>
> Kind regards,
> Pantelis Natsiavas