webservice中发布服务端遇到的异常

在写webservice的过程中,运行服务端的程序,遇到了一些异常,下面贴出这些异常信息,以及我的解决方法:
1、异常信息1

Exception in thread "main" com.sun.xml.internal.ws.server.ServerRtException: 服务器运行时错误: java.io.IOException: Unable to establish loopback connection
    at com.sun.xml.internal.ws.transport.http.server.ServerMgr.createContext(Unknown Source)
    at com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(Unknown Source)
    at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(Unknown Source)
    at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(Unknown Source)
    at javax.xml.ws.Endpoint.publish(Unknown Source)
    at com.wzuden.service.ServiceHello.main(ServiceHello.java:17)
Caused by: java.io.IOException: Unable to establish loopback connection
    at sun.nio.ch.PipeImpl$Initializer.run(Unknown Source)
    at sun.nio.ch.PipeImpl$Initializer.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.nio.ch.PipeImpl.<init>(Unknown Source)
    at sun.nio.ch.SelectorProviderImpl.openPipe(Unknown Source)
    at java.nio.channels.Pipe.open(Unknown Source)
    at sun.nio.ch.WindowsSelectorImpl.<init>(Unknown Source)
    at sun.nio.ch.WindowsSelectorProvider.openSelector(Unknown Source)
    at java.nio.channels.Selector.open(Unknown Source)
    at sun.net.httpserver.ServerImpl.<init>(Unknown Source)
    at sun.net.httpserver.HttpServerImpl.<init>(Unknown Source)
    at sun.net.httpserver.DefaultHttpServerProvider.createHttpServer(Unknown Source)
    at com.sun.net.httpserver.HttpServer.create(Unknown Source)
    ... 6 more
Caused by: java.net.ConnectException: Connection refused: connect
    at sun.nio.ch.Net.connect0(Native Method)
    at sun.nio.ch.Net.connect(Unknown Source)
    at sun.nio.ch.Net.connect(Unknown Source)
    at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
    at java.nio.channels.SocketChannel.open(Unknown Source)
    at sun.nio.ch.PipeImpl$Initializer$LoopbackConnector.run(Unknown Source)
    ... 19 more

原因与解决方法:因为我是在公司使用的代理上网,去掉代理即可。。

2、异常信息2

Exception in thread "main" com.sun.xml.internal.ws.server.ServerRtException: 服务器运行时错误: java.net.BindException: Address already in use: bind
    at com.sun.xml.internal.ws.transport.http.server.ServerMgr.createContext(Unknown Source)
    at com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(Unknown Source)
    at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(Unknown Source)
    at com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(Unknown Source)
    at javax.xml.ws.Endpoint.publish(Unknown Source)
    at com.wzuden.service.ServiceHello.main(ServiceHello.java:17)
Caused by: java.net.BindException: Address already in use: bind
    at sun.nio.ch.Net.bind0(Native Method)
    at sun.nio.ch.Net.bind(Unknown Source)
    at sun.nio.ch.Net.bind(Unknown Source)
    at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
    at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
    at sun.net.httpserver.ServerImpl.<init>(Unknown Source)
    at sun.net.httpserver.HttpServerImpl.<init>(Unknown Source)
    at sun.net.httpserver.DefaultHttpServerProvider.createHttpServer(Unknown Source)
    at com.sun.net.httpserver.HttpServer.create(Unknown Source)
    ... 6 more

原因与解决方法:端口已经被占用,换个端口即可。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值