Skip to main content

JAX-WS sending attachements java.nio.channels.ClosedChannelException

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
bazic
Offline
Joined: 2012-09-28

I have a webservice using JAX-WS and MTOM for sending large attachements , i can send a file over 10Gb, the problem is when i try to send multiple files in a directory , then i get this exception after 10-15 minutes:

GRAVE: java.nio.channels.ClosedChannelException
org.jvnet.mimepull.MIMEParsingException: java.nio.channels.ClosedChannelException
at org.jvnet.mimepull.MIMEParser.fillBuf(MIMEParser.java:436)
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(Unknown Source)
at org.jvnet.mimepull.DataHead.moveTo(DataHead.java:100)
at org.jvnet.mimepull.MIMEPart.moveTo(MIMEPart.java:112)
at com.sun.xml.ws.developer.StreamingDataHandler$StreamingDataSource.moveTo(StreamingDataHandler.java:105)
at com.sun.xml.ws.developer.StreamingDataHandler.moveTo(StreamingDataHandler.java:78)
at fr.gipmds.service.UploadService.getFichier(UploadService.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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:93)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:444)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
at com.sun.xml.ws.transport.http.server.WSHttpHandler.handleExchange(WSHttpHandler.java:106)
at com.sun.xml.ws.transport.http.server.WSHttpHandler.handle(WSHttpHandler.java:91)
at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)
at sun.net.httpserver.AuthFilter.doFilter(Unknown Source)
at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)
at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(Unknown Source)
at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)
at sun.net.httpserver.ServerImpl$Exchange.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.nio.channels.ClosedChannelException
at sun.nio.ch.SocketChannelImpl.ensureReadOpen(Unknown Source)
at sun.nio.ch.SocketChannelImpl.read(Unknown Source)
at sun.net.httpserver.Request$ReadStream.available(Unknown Source)
at sun.net.httpserver.Request$ReadStream.block(Unknown Source)
at sun.net.httpserver.Request$ReadStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.httpserver.ChunkedInputStream.readChunkHeader(Unknown Source)
at sun.net.httpserver.ChunkedInputStream.readImpl(Unknown Source)
at sun.net.httpserver.LeftOverInputStream.read(Unknown Source)
at java.io.FilterInputStream.read(Unknown Source)
at org.jvnet.mimepull.MIMEParser.fillBuf(MIMEParser.java:434)
... 39 more
java.io.IOException: stream is closed
at sun.net.httpserver.Request$WriteStream.write(Unknown Source)
at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
at java.io.BufferedOutputStream.flush(Unknown Source)
at sun.net.httpserver.ExchangeImpl.sendResponseHeaders(Unknown Source)
at sun.net.httpserver.HttpExchangeImpl.sendResponseHeaders(Unknown Source)
at com.sun.xml.ws.transport.http.server.ServerConnectionImpl.getOutput(ServerConnectionImpl.java:153)
at com.sun.xml.ws.transport.http.HttpAdapter.encodePacket(HttpAdapter.java:313)
at com.sun.xml.ws.transport.http.HttpAdapter.access$100(HttpAdapter.java:93)
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:454)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
at com.sun.xml.ws.transport.http.server.WSHttpHandler.handleExchange(WSHttpHandler.java:106)
at com.sun.xml.ws.transport.http.server.WSHttpHandler.handle(WSHttpHandler.java:91)
at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)
at sun.net.httpserver.AuthFilter.doFilter(Unknown Source)
at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)
at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(Unknown Source)
at com.sun.net.httpserver.Filter$Chain.doFilter(Unknown Source)
at sun.net.httpserver.ServerImpl$Exchange.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

does anyone have a clue?

Thanks in advance

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bazic
Offline
Joined: 2012-09-28

After some investigation , i found out that's related to the time of execution , it means after 10 min , i get the exception no matter the size of the files is , but still can't figure out the reason ...

hope somebody have faced this problem