簡體   English   中英

javax.xml.ws.WebServiceException:java.io.IOException:寫入服務器Tomcat 8時出錯

[英]javax.xml.ws.WebServiceException: java.io.IOException: Error writing to server Tomcat 8

我們最近將在JRE 1.7.0_17 / Tomcat7.0.39上運行的JAX-WS Web服務的技術堆棧更新為JRE 1.8.0_66 / Tomcat 8.0.28。 Web應用程序在Windows Server 2012上運行.Web服務使用Metro實現JAX-WS。 客戶端使用JRE 7和JRE中內置的JAX-WS客戶端API在各種Windows版本上運行。 Web服務用於將文件從客戶端計算機上載到Web服務,將Web服務保存在文檔管理系統中。 在Java 7 / Tomcat 7下,實現工作非常完美,但我們遇到了在Java 8 / Tomcat 8服務器端運行的更大負載(2MB或更大)的問題。 來自客戶端的堆棧跟蹤是:

12/02/2015 14:12:38.699 [AWT-EventQueue-0] ERROR  DocumentImporterMainWindow$SwingAction.importDocument: Unexpected Problem trying to call the CustomerOrderDMService
javax.xml.ws.WebServiceException: java.io.IOException: Error writing to server
    at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(Unknown Source)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(Unknown Source)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(Unknown Source)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(Unknown Source)
    at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(Unknown Source)
    at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Unknown Source)
    at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Unknown Source)
    at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Unknown Source)
    at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Unknown Source)
    at com.sun.xml.internal.ws.client.Stub.process(Unknown Source)
    at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(Unknown Source)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
    at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)
    at com.sun.proxy.$Proxy30.importDocument(Unknown Source)
    at com.mycompany.documentimporter.DocumentImporterMainWindow$SwingAction.importDocument(DocumentImporterMainWindow.java:681)
    at com.mycompany.documentimporter.DocumentImporterMainWindow$SwingAction.actionPerformed(DocumentImporterMainWindow.java:612)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$500(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.io.IOException: Error writing to server
    at sun.net.www.protocol.http.HttpURLConnection.writeRequests(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.writeRequests(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at java.net.HttpURLConnection.getResponseCode(Unknown Source)
    ... 54 more

遺憾的是,在任何tomcat日志中都沒有記錄服務器端。 我花了幾天時間尋找問題的解決方案而沒有成功。 我試圖通過各種途徑調試問題,例如使用-Dcom.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true (客戶端)記錄SOAP請求/響應客戶端和服務器端,並且-Dcom.sun.xml.ws.transport.http.HttpAdapter.dump=true (服務器)java系統屬性,但是當發生錯誤時,只記錄客戶端請求:

---[HTTP request - http://localhost:8080/CustomerOrderDM/services/CustomerOrderDMService]---
Accept: text/xml, multipart/related
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://www.mycompany.com/CustomerOrderDMService/ImportDocument"
User-Agent: JAX-WS RI 2.2.9-b130926.1035 svn-revision#5f6196f2b90e9460065a4c2f4e30e065b245e51e
<?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns3:ImportDocumentRequestDTO xmlns:ns3="http://www.mycompany.com/CustomerOrderDMService/" xmlns:ns2="http://www.mycompany.com/CustomerOrderDMService"><ns2:QuoteNumber>A000049</ns2:QuoteNumber><ns2:SerialNumber>STOCK</ns2:SerialNumber><ns2:DocumentType>Email</ns2:DocumentType><ns2:Description></ns2:Description><ns2:DocumentContents> **some base64 encoded byte[] of the file contents being uploaded**

Message has been truncated
use com.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold property to increase the amount of printed part of the message
--------------------

由於只記錄了客戶端請求,我們預計服務器沒有完全處理請求,並且它正在落入某種異常塊,但是沒有任何記錄到服務器日志文件的任何內容,我們在解決問題時遇到了困難。

我們已經嘗試使用代理,例如Eclipse中內置的監控,但我再次只看到來自客戶端的請求而沒有來自服務器的響應(當客戶端發送更大的請求失敗時,小客戶端請求/響應請求/響應)和服務器)。 其他調試建議將不勝感激。

我們還嘗試了Java和Tomcat的不同組合:

  • Tomcat 7 / Java 7 =正常工作
  • Tomcat 7 / Java 8 =正常工作
  • Tomcat 8 / Java 7 =不起作用
  • Tomcat 8 / Java 8 =不起作用

這導致我們認為問題出在Tomcat 8上。在Tomcat 8中改變了一些東西,我們現在需要設置一些新的超時/有效負載設置,或者Tomcat 8有一個與此特定問題相關的錯誤。

我們嘗試設置一些Tomcat連接器設置,如maxPostSize="-1"connectionTimeout="-1"disableUploadTimeout="true"connectionUploadTimeout="-1"keepAliveTimeout="-1"但這些都不起作用,說實話,在不知道服務器端發生了什么的情況下,感覺像是在黑暗中拍攝。

我們已經嘗試將Metro jars服務器端更新到最新版本(jaxws-ri-2.2.10)以及使用Java 8運行客戶端。不幸的是,這些都不起作用。 任何幫助將不勝感激。

事實證明,Tomcat 7.0.55包括修復:

CVE-2014-0230:
Add a new limit, defaulting to 2MB, for the amount of data Tomcat will swallow for an aborted upload. The limit is configurable by maxSwallowSize attribute of an HTTP connector. 

通過在tomcat servers server.xml中的<Connector>配置上設置maxSwallowSize =“ - 1”設置解決了我的問題。

我要感謝Tomcat用戶郵件列表中的Mark Thomas和Chris Schultz的幫助。 有關如何加入郵件列表的說明,請單擊此處 我還要感謝Vinayak指出我對Tomcat的支持。

似乎這更像是與Tomcat相關的錯誤。 將問題發布給Tomcat團隊。

http://tomcat.apache.org/bugreport.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM