自Java8升级以来,jax ws端点在套接字上的写入被阻止

自Java8升级以来,jax ws端点在套接字上的写入被阻止,java,jax-ws,java-8,streamwriter,chunked-encoding,Java,Jax Ws,Java 8,Streamwriter,Chunked Encoding,我们将JAX-WS实现与JAXB for webservices结合使用,我们最近升级到了jdk 8,因为我们的端点在发送响应时遇到了问题。深入研究之后,我意识到端点线程在套接字上写入时被阻塞 这里是当执行被阻止时来自服务器端的线程堆栈跟踪,您可以看到它在写入时被阻止。客户端也会被阻止读取,直到达到超时 Daemon Thread [jaxws-engine-WSEndpointSever::WSEnpointServer-3-thread-1] (Suspended) owns

我们将JAX-WS实现与JAXB for webservices结合使用,我们最近升级到了jdk 8,因为我们的端点在发送响应时遇到了问题。深入研究之后,我意识到端点线程在套接字上写入时被阻塞

这里是当执行被阻止时来自服务器端的线程堆栈跟踪,您可以看到它在写入时被阻止。客户端也会被阻止读取,直到达到超时

Daemon Thread [jaxws-engine-WSEndpointSever::WSEnpointServer-3-thread-1] (Suspended)    
    owns: Object  (id=8288) 
    owns: Request$WriteStream  (id=8289)    
    SocketDispatcher.write0(FileDescriptor, long, int) line: not available [native method] [local variables unavailable]    
    SocketDispatcher.write(FileDescriptor, long, int) line: 51  
    IOUtil.writeFromNativeBuffer(FileDescriptor, ByteBuffer, long, NativeDispatcher) line: 93   
    IOUtil.write(FileDescriptor, ByteBuffer, long, NativeDispatcher) line: 65   
    SocketChannelImpl.write(ByteBuffer) line: 470   
    Request$WriteStream.write(byte[], int, int) line: 391   
    ChunkedOutputStream.writeChunk() line: 125 [local variables unavailable]    
    ChunkedOutputStream.flush() line: 159 [local variables unavailable] 
    PlaceholderOutputStream.flush() line: 449 [local variables unavailable] 
    ServerConnectionImpl$1(FilterOutputStream).flush() line: 140 [local variables unavailable]  
    UTF8OutputStreamWriter.flush() line: 138    
    XMLStreamWriterImpl.flush() line: 397   
    XMLStreamWriterFactory$HasEncodingWriter(XMLStreamWriterFilter).flush() line: 56    
    SAAJMessage.writeTo(XMLStreamWriter) line: 365  
    MessageWrapper.writeTo(XMLStreamWriter) line: 206   
    StreamSOAP11Codec(StreamSOAPCodec).encode(Packet, OutputStream) line: 129   
    SOAPBindingCodec.encode(Packet, OutputStream) line: 227 
    ServerAdapter(HttpAdapter).encodePacket(Packet, WSHTTPConnection, Codec) line: 474  
    HttpAdapter.access$100(HttpAdapter, Packet, WSHTTPConnection, Codec) line: 90   
    HttpAdapter$HttpToolkit.handle(WSHTTPConnection) line: 716  
    ServerAdapter(HttpAdapter).handle(WSHTTPConnection) line: 260   
    WSHttpHandler.handleExchange(HttpExchange) line: 98 
    WSHttpHandler.access$000(WSHttpHandler, HttpExchange) line: 47  
    WSHttpHandler$HttpHandlerRunnable.run() line: 122   
    ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker) line: 1142  
    ThreadPoolExecutor$Worker.run() line: 617   
    Thread.run() line: 745  
这是在随机情况下发生的,当响应较短时,它几乎不会发生,但在响应较大时会非常频繁

Java8中有什么我们应该注意的新内容吗

下面是它基本上是如何发布到Web服务的

服务器端

        Endpoint endpoint = Endpoint.create(inServiceImpl );
        endpoint.setExecutor( m_threadPoolExecutor );

        SOAPBinding binding = (SOAPBinding) endpoint.getBinding();


        List<Handler> handlerChain = new LinkedList<Handler>();
        handlerChain.add( new SOAPTraceHandler( jaxEndopoint.getEndPointURL(),jaxEndopoint.getService() ) );
        binding.setHandlerChain( handlerChain );


        // publish the endpoint and make available.
        endpoint.publish( jaxEndopoint.getEndPointURL() );
    m_service = proxy.getPort( Service.class );

    BindingProvider binding = (BindingProvider) m_service;
    Map<String, Object> ctxt = binding.getRequestContext();
    ctxt.put(JAXWSProperties.REQUEST_TIMEOUT, 50000);

    //run method.
    m_service.runMethod(Payload);
原因:javax.xml.bind.MarshalException -除此之外: [com.sun.istack.saxException 2:com.sun.istack.saxException 2:超时 org.eclipse.jetty.io.EofException:超时 javax.xml.transform.TransformerException:com.sun.istack.saxException 2:超时 org.eclipse.jetty.io.EofException:超时]

非常感谢你的帮助。 提前谢谢

问候

nov 10, 2014 4:20:14 EM com.sun.xml.ws.transport.http.servlet.WSServletDelegate doGet
SEVERE: caught throwable
javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException
 - with linked exception:
[com.sun.istack.SAXException2: com.sun.istack.SAXException2: timeout
org.eclipse.jetty.io.EofException: timeout
javax.xml.transform.TransformerException: com.sun.istack.SAXException2: timeout
org.eclipse.jetty.io.EofException: timeout]
at com.sun.xml.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:322)
at com.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:142)
at com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:108)
at com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:258)
at com.sun.xml.ws.transport.http.HttpAdapter.encodePacket(HttpAdapter.java:320)
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.servlet.ServletAdapter.handle(ServletAdapter.java:135)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:366)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:745)