日期:2014-05-17  浏览次数:20673 次

axis2 异常问题
一个项目中,通过webservice方式调用远程服务器接口,异常代码段:

boolean flagXml = true;
String xmlDate = "";
while (flagXml) {
QName qname = new QName(qn, "GetReport");
Object[] result = client.invokeBlocking(qname,
new Object[] { validation, bid },
new Class[] { String.class });
if (result[0].toString().contains("Message")) {

xmlDate = result[0].toString();
break;
}
}


在一台服务器上部署客户端应用后正常,没有异常,在另一台服务器上部署后测试异常端口号占用:

Caused by: java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_
Bind
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
        at java.net.Socket.bind(Socket.java:565)
        at sun.reflect.GeneratedMethodAccessor95.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.create
Socket(ReflectionSocketFactory.java:139)
        at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.c
reateSocket(DefaultProtocolSocketFactory.java:125)
        at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java
:707)
        at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$Http
ConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
        at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(Htt
pMethodDirector.java:387)
        at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMe
thodDirector.java:171)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav
a:397)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav
a:346)
        at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(Abst
ractHTTPSender.java:542)
        at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.jav
a:189)
        ... 12 more
org.apache.axis2.AxisFault: Unrecognized Windows Sockets error: 0: JVM_Bind
        at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
        at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.jav
a:193)
        at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
      &n