开发者

java.nio.channels.ClosedChannelException -Client shuts down SSL

HI,

I have a webservice running on glassfish3.1 server on one machine.

On second machine I have a java (GUI) app, that is running and calls the above mentioned web service.

In my webservice call, i send a file as SOAP attachment. It reaches the server, the file is then processed and then it is returned back to my client machine over https.

If my file is too large and takes more than 15 mins, the operation fails and I get the following error:

On Client side: Couldn't create SOAP message due to exception: org.jvnet.mimepull.MIMEParsingException: javax.net.ssl.SSLException: SSL peer shut down incorrectly

on server side: javax.servlet.ServletException at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:150) at javax.servlet.http.HttpServlet.service(HttpServlet.java:755) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1534) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:326) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:227) 开发者_如何学C at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:170) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) at com.sun.grizzly.ContextTask.run(ContextTask.java:71) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) at java.lang.Thread.run(Thread.java:662) Caused by: javax.xml.ws.WebServiceException: com.ctc.wstx.exc.WstxIOException: java.nio.channels.ClosedChannelException at com.sun.xml.ws.encoding.MtomCodec.encode(MtomCodec.java:184) at com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:282) at com.sun.xml.ws.transport.http.HttpAdapter.encodePacket(HttpAdapter.java:400) at com.sun.xml.ws.transport.http.HttpAdapter.access$100(HttpAdapter.java:96) at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:618) at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:259) at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:162) at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:145) ... 27 more Caused by: com.ctc.wstx.exc.WstxIOException: java.nio.channels.ClosedChannelException at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:313) at com.sun.xml.ws.util.xml.XMLStreamWriterFilter.flush(XMLStreamWriterFilter.java:71) at com.sun.xml.ws.streaming.XMLStreamWriterUtil.getOutputStream(XMLStreamWriterUtil.java:101) at com.sun.xml.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:320) at com.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:147) at com.sun.xml.ws.encoding.MtomCodec.encode(MtomCodec.java:168) ... 34 more Caused by: org.apache.catalina.connector.ClientAbortException: java.nio.channels.ClosedChannelException at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:382) at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:351) at org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:175) at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:99) at com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:214) at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:311) ... 39 more Caused by: java.nio.channels.ClosedChannelException at sun.nio.ch.SocketChannelImpl.ensureWriteOpen(SocketChannelImpl.java:133) at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:324) at com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:108) at com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:76) at com.sun.grizzly.util.SSLOutputWriter.flushChannel(SSLOutputWriter.java:102) at com.sun.grizzly.ssl.SSLOutputBuffer.flushChannel(SSLOutputBuffer.java:138) at com.sun.grizzly.http.SocketChannelOutputBuffer.flushBuffer(SocketChannelOutputBuffer.java:398) at com.sun.grizzly.http.SocketChannelOutputBuffer.flush(SocketChannelOutputBuffer.java:376) at com.sun.grizzly.http.ProcessorTask.action(ProcessorTask.java:1241) at com.sun.grizzly.ssl.SSLProcessorTask.action(SSLProcessorTask.java:164) at com.sun.grizzly.tcp.Response.action(Response.java:268) at org.apache.catalina.connector.OutputBuffer.doFlush(Output

...

I think that SSL session is timed out on my client side and not on the server side.

Now I am trying to figure out a way to increase the SSL timeout on my client side which i suppose is 15 mins...

I am not able to do so, any help would be appriciated... Thank you


I think that SSL session is timed out on my client side

No. Your client encountered a closed (reset) connection without first receiving an SSL close_notify from the server. So it wasn't the client. I would guess that the server is imposing a POST size limit and closing the connection when you exceed it.

If you are sending too much data you are going to experience IOExceptions somewhere or other. Either obey the limit or raise it, and obey the new value.


Open your domain.xml and try to find out which SSL version you are using. If you see something like the following one[ ssl3-enabled="false" ], then it's SSL2 which has default timeout of 100 seconds.

<ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl"  ssl3-enabled="false" cert-nickname="s1as"></ssl>

In such a scenario either you can put some bigger value to ssl-session-timeout property[you may need to add this]

or you may opt for using ssl3 over ssl which has larger value for timeout by default.

Ref: http://download.oracle.com/docs/cd/E19798-01/821-1753/abhaq/index.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜