我正在使用一個實現自定義功能的JAR文件作爲REST客戶端(版本2.22.1)。儘管對於幾次調用,一切似乎都正常,但對於特定的HTTP調用,我收到「錯誤:寫入服務器」,,但只能在ubuntu中運行。「錯誤:寫入服務器」 - 僅在ubuntu上發生
在我的兩個ubuntu開發電腦上運行單元測試時發生錯誤。我在開發PC都的Ubuntu 16.04與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)
$ java -version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
運行從Windows機相同的測試,讓我沒有錯誤。在我的Windows機器:
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)
完整的錯誤的堆棧跟蹤是:
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(JerseyInvocation.java:684) at org.glassfish.jersey.client.JerseyInvocation$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.JerseyInvocation.invoke(JerseyInvocation.java:681) at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:437) at org.glassfish.jersey.client.JerseyInvocation$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.internal.HttpUrlConnector._apply(HttpUrlConnector.java:394) at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:285)
... 40 more
我只能假定有兩個原因的錯誤:
- 的JVM版本
- 的區別兩個操作系統之間的不同網絡設置
這個錯誤出現在棘手的大http加載的特定請求中。許多職位的同事都建議在發生大量http請求時發生這種情況,但是我沒有找到任何提出解決方案或專門將其與Ubuntu相關的帖子。
任何提示?
哪一個會影響這種功能的網絡參數?我怎麼能改變/適應它們?
是否需要特定的jvm配置?