如何解决Web服务抛出的异常?

时间:2015-04-08 07:59:15

标签: java web-services

从简单的Java客户端调用Web服务时遇到了一个问题;我想要你所有的答案!

以下是客户抛出的例外情况:

Exception in thread "main" java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:1010/helloworld
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at org.warnier.zhang.demo.Tests.main(Tests.java:40)

以下是服务器抛出的异常:

javax.xml.ws.WebServiceException: javax.xml.stream.XMLStreamException: java.io.IOException: 远程主机强迫关闭了一个现有的连接。(Translation: connection was forcibly closed by the remote host)
    at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.encode(Unknown Source)
    at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.encode(Unknown Source)
    at com.sun.xml.internal.ws.transport.http.HttpAdapter.encodePacket(Unknown Source)
    at com.sun.xml.internal.ws.transport.http.HttpAdapter.access$100(Unknown Source)
    at com.sun.xml.internal.ws.transport.http.HttpAdapter$HttpToolkit.handle(Unknown Source)
    at com.sun.xml.internal.ws.transport.http.HttpAdapter.handle(Unknown Source)
    at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handleExchange(Unknown Source)
    at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handle(Unknown Source)
    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.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.stream.XMLStreamException: java.io.IOException: 远程主机强迫关闭了一个现有的连接。
    at com.sun.xml.internal.stream.writers.XMLStreamWriterImpl.flush(Unknown Source)
    ... 17 more
Caused by: java.io.IOException: 远程主机强迫关闭了一个现有的连接。 (Translation: connection was forcibly closed by the remote host)
    at sun.nio.ch.SocketDispatcher.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(Unknown Source)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(Unknown Source)
    at sun.nio.ch.IOUtil.write(Unknown Source)
    at sun.nio.ch.SocketChannelImpl.write(Unknown Source)
    at sun.net.httpserver.Request$WriteStream.write(Unknown Source)
    at sun.net.httpserver.ChunkedOutputStream.writeChunk(Unknown Source)
    at sun.net.httpserver.ChunkedOutputStream.flush(Unknown Source)
    at sun.net.httpserver.PlaceholderOutputStream.flush(Unknown Source)
    at java.io.FilterOutputStream.flush(Unknown Source)
    at com.sun.xml.internal.stream.writers.UTF8OutputStreamWriter.flush(Unknown Source)
    ... 18 more

0 个答案:

没有答案