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.ProcessingException: java.io.IOException: Error writing to
server
at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(
HttpUrlConnector.java:287)
at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:255)
at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyIn
vocation.java:684)
at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyIn
vocation.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.runInScop
e(RequestScope.java:444)
at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyIn
vocation.java:681)
at org.glassfish.jersey.client.JerseyInvocation$Builder.method(
JerseyInvocation.java:437)
at org.glassfish.jersey.client.JerseyInvocation$Builder.put(Jer
seyInvocation.java:326)
....
Caused by: java.io.IOException: Error writing to server
at sun.net.www.protocol.http.HttpURLConnection.writeRequests(Ht
tpURLConnection.java:666)
at sun.net.www.protocol.http.HttpURLConnection.writeRequests(Ht
tpURLConnection.java:678)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(
HttpURLConnection.java:1534)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(H
ttpURLConnection.java:1441)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at org.glassfish.jersey.client.internal.HttpUrlConnector._apply
(HttpUrlConnector.java:394)
at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(
HttpUrlConnector.java:285)
... 40 more
Kind regards,
Pantelis Natsiavas