我开发了一个用于在服务器上传文件的Web服务,它是使用Metro 2.1 JAX-WS引擎创建的,并部署在web sphere 7.0上。我可以连接到此服务并成功传输文件,但有时会抛出java.net.SocketTimeoutException:异步操作超时。
以下是服务器堆栈跟踪 -
可能是因为错误的n / w问题和上传的文件也是合理的大小所以我们决定将超时值增加到5分钟但是在尝试大量代码更改后我无法增加它。我尝试了以下方法来增加超时值,但似乎没有任何效果。
我试图将超时值设置为“1”以测试是否发生超时但是Web服务似乎没有超时而正常滚动。
我很感激这里的快速帮助。
谢谢,
((BindingProvider)port).getRequestContext().put(BindingProviderProperties.CONNECT_TIMEOUT, 1);
((BindingProvider)port).getRequestContext().put(BindingProviderProperties.REQUEST_TIMEOUT, 1);
和
((BindingProvider)port).getRequestContext().put("com.sun.xml.ws.request.timeout", 100);
((BindingProvider)port).getRequestContext().put("com.sun.xml.ws.connect.timeout", 100);
AND
((BindingProvider)port).getRequestContext().put("com.sun.xml.internal.ws.request.timeout", 1);
((BindingProvider)port).getRequestContext().put("com.sun.xml.internal.ws.connect.timeout", 1);
java.net.SocketTimeoutException: Async operation timed out at com.ibm.ws.tcp.channel.impl.AioTCPReadRequestContextImpl.processSyncReadRequest(AioTCPReadRequestContextImpl.java:189) at com.ibm.ws.tcp.channel.impl.TCPReadRequestContextImpl.read(TCPReadRequestContextImpl.java:111) at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext.read(SSLReadServiceContext.java:265) at com.ibm.ws.http.channel.impl.HttpServiceContextImpl.fillABuffer(HttpServiceContextImpl.java:4142) at com.ibm.ws.http.channel.impl.HttpServiceContextImpl.readSingleBlock(HttpServiceContextImpl.java:3374) at com.ibm.ws.http.channel.impl.HttpServiceContextImpl.readBodyBuffer(HttpServiceContextImpl.java:3494) at com.ibm.ws.http.channel.inbound.impl.HttpInboundServiceContextImpl.getRequestBodyBuffer(HttpInboundServiceContextImpl.java:1705) at com.ibm.ws.webcontainer.channel.WCCByteBufferInputStream.bufferIsGood(WCCByteBufferInputStream.java:373) at com.ibm.ws.webcontainer.channel.WCCByteBufferInputStream.read(WCCByteBufferInputStream.java:266) at com.ibm.ws.webcontainer.srt.http.HttpInputStream.read(HttpInputStream.java:325) at org.jvnet.mimepull.MIMEParser.fillBuf(MIMEParser.java:434) at org.jvnet.mimepull.MIMEParser.readBody(MIMEParser.java:204) at org.jvnet.mimepull.MIMEParser.access$600(MIMEParser.java:62) at org.jvnet.mimepull.MIMEParser$MIMEEventIterator.next(MIMEParser.java:154) at org.jvnet.mimepull.MIMEParser$MIMEEventIterator.next(MIMEParser.java:123) at org.jvnet.mimepull.MIMEMessage.makeProgress(MIMEMessage.java:193) at org.jvnet.mimepull.DataHead$ReadMultiStream.fetch(DataHead.java:236) at org.jvnet.mimepull.DataHead$ReadMultiStream.read(DataHead.java:207) at java.io.InputStream.read(InputStream.java:97) at javax.activation.DataHandler.writeTo(DataHandler.java:307) at com.ncr.java.service.ValidateRequest.validateCaptureFileContent(ValidateRequest.java:357) at com.ncr.java.service.CaptureFileReceiverImpl.uploadCaptureFile(CaptureFileReceiverImpl.java:167) at com.ncr.java.service.CaptureFileReceiverImplDelegate.uploadCaptureFile(CaptureFileReceiverImplDelegate.java:46) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246) at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146) at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257) at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:95) at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629) at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588) at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573) at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470) at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:295) at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:515) at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:285) at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:143) at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:155) at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:189) at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:76) at javax.servlet.http.HttpServlet.service(HttpServlet.java:738) at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502) at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179) at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:864) at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305) at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83) at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1784) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604) Caused by: com.ibm.io.async.AsyncTimeoutException(Async operation timed out, [Timeout, rc=0]) at com.ibm.io.async.AbstractAsyncFuture.waitForCompletion(AbstractAsyncFuture.java:359) at com.ibm.io.async.AsyncFuture.getByteCount(AsyncFuture.java:218) at com.ibm.ws.tcp.channel.impl.AioSocketIOChannel.readAIOSync(AioSocketIOChannel.java:215) at com.ibm.ws.tcp.channel.impl.AioTCPReadRequestContextImpl.processSyncReadRequest(AioTCPReadRequestContextImpl.java:182) ... 64 more Reporter BEGIN:com.ibm.ws.webcontainer.channel.WCCByteBufferInputStream@447e447e java.io.InputStream::SKIP_BUFFER_SIZE:2048 java.io.InputStream::skipBuffer:null com.ibm.ws.webcontainer.channel.WCCByteBufferInputStream::logger:com.ibm.wsspi.webcontainer.logging.WebContainerLogger@2d512d51 com.ibm.ws.webcontainer.channel.WCCByteBufferInputStream::CLASS_NAME:com.ibm.ws.webcontainer.channel.WCCByteBufferInputStream com.ibm.ws.webcontainer.channel.WCCByteBufferInputStream::isc BEGIN:com.ibm.ws.http.channel.inbound.impl.HttpInboundServiceContextImpl@4b574b57 com.ibm.ws.http.channel.impl.HttpServiceContextImpl::tc BEGIN:com.ibm.ejs.ras.TraceComponent@4b344b34 com.ibm.ejs.ras.TraceElement::ivLevel:10 com.ibm.ejs.ras.TraceElement::ivName:com.ibm.ws.http.channel.impl.HttpServiceContextImpl com.ibm.ejs.ras.TraceElement::ivDebugEnabled:false com.ibm.ejs.ras.TraceElement::ivEventEnabled:false com.ibm.ejs.ras.TraceElement::ivEntryEnabled:false
答案 0 :(得分:0)
stacktrace说服务器上的webservice在从客户端读取数据时会超时。
在conrast设置中,getRequestContext()上的超时道具会在等待来自服务器的响应时影响ws-client。
似乎非常低的客户端超时测试“成功”。客户过早地中断请求并中止请求。这在尝试分析请求的mime类型时导致服务器端超时。
尝试将客户端超时增加到所需的值。