XFire 多线程客户端请求服务端时报错
Address already in use: connect 这么解决,求高人指点
本帖最后由 guowei_love 于 2014-03-27 11:26:02 编辑
2014-03-27 11:03:28 INFO [org.apache.commons.httpclient.HttpMethodDirector] I/O exception (
java.net.BindException) caught when processing request: Address already in use: connect
2014-03-27 11:03:28 INFO [org.apache.commons.httpclient.HttpMethodDirector] Retrying request
2014-03-27 11:03:28 INFO [org.apache.commons.httpclient.HttpMethodDirector] I/O exception (java.net.
BindException) caught when processing request: Address already in use: connect
2014-03-27 11:03:28 INFO [org.apache.commons.httpclient.HttpMethodDirector] Retrying request
2014-03-27 11:03:28 INFO [org.apache.commons.httpclient.HttpMethodDirector] I/O exception (java.net.BindException) caught when processing request: Address already in use: connect
2014-03-27 11:03:28 INFO [org.apache.commons.httpclient.HttpMethodDirector] Retrying request
2014-03-27 11:03:28 ERROR [org.codehaus.xfire.transport.http.HttpChannel]
java.net.BindException: Address already in use: connect
org.codehaus.xfire.XFire
RuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Couldn't send message.
org.codehaus.xfire.fault.XFireFault: Couldn't send message.
at org.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89)
at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:30)
at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)
at org.codehaus.xfire.client.Client.invoke(Client.java:336)
at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
at $Proxy0.getCustomService(Unknown Source)
at com.kz.util.Test.main(Test.java:30)
Caused by: org.codehaus.xfire.XFireException: Couldn't send message.
at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:145)
at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
... 8 more
Caused by: java.net.BindException: Address already in use: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:240)
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80)
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122)
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.codehaus.xfire.transport.http.CommonsHttpMessageSender.send(CommonsHttpMessageSender.java:369)
at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:123)
... 10 more
------解决方案--------------------应该不至于啊,因为web service不比数据库,不存在关闭的事情。
推荐:在进程里调用web service,然后在线程里去使用它,这样是否可以解决“Address already in use”
------解决方案--------------------你单线程试试,应该是绑定 重复的问题。
------解决方案--------------------你换个端口试试呢。