我正在创建一个样例应用程序(Java),它会收集信息并将该信息发送到使用.NET构建的Web服务。通常情况下一切正常,两个平台之间可以完美通信。
但是,经过一段时间后,我遇到了 (java.net.SocketException) java.net.SocketException: Permission denied: connect 错误。
我通过谷歌搜索发现这是JDK7的问题。我只想确认一下,这是否只是JDK7的问题,还是我们可以解决它?
我正在创建一个样例应用程序(Java),它会收集信息并将该信息发送到使用.NET构建的Web服务。通常情况下一切正常,两个平台之间可以完美通信。
但是,经过一段时间后,我遇到了 (java.net.SocketException) java.net.SocketException: Permission denied: connect 错误。
我通过谷歌搜索发现这是JDK7的问题。我只想确认一下,这是否只是JDK7的问题,还是我们可以解决它?
public void sendHttpPost() throws ClientProtocolException, IOException {
HttpMethodBase httpPostRequest = new PostMethod(url + buildParams());
try {
// add headers
Iterator it = headers.entrySet().iterator();
while (it.hasNext()) {
Entry header = (Entry) it.next();
httpPostRequest.addRequestHeader((String) header.getKey(), (String) header.getValue());
}
((PostMethod) httpPostRequest).setRequestEntity( new StringRequestEntity(new
String(reqEntity), "text/plain", Constants.DEFAULT_ENCODING));
try {
respCode = client.executeMethod(httpPostRequest);
response = httpPostRequest.getResponseBodyAsString();
this.responsePhrase = httpPostRequest.getStatusText();
}catch(Exception ex){
System.out.println("ErrorS "+ex.toString());
} finally {
httpPostRequest.releaseConnection();
}
}catch(Exception ex){
System.out.println("ErrorD "+ex.toString());
}
finally {
}
}