简体   繁体   English

客户计算机上的Apache httpclient超时(处理请求时捕获了I / O异常:连接超时

[英]Apache httpclient timeout on customers machine (I/O Exception caught when processing request: Connection timed out

I'm recieving a timeout issue attempting to connect to and query Rally via Java code using Apache HttpClient 3.0 我收到尝试使用Apache HttpClient 3.0通过Java代码连接并查询Rally的超时问题

I do not get this issue using xmlhttprequest. 没有使用xmlhttprequest得到这个问题。

I cannot reproduce this on any machine but the one that it is failing on. 我无法在任何机器上重现此错误,但是它正在失败。 Could this be a cacerts issue since the host is https? 由于主机是https,这可能是cacerts问题吗? Could there be a way to check for proxies? 有没有办法检查代理? Any logging suggestions to get more info? 任何记录建议以获取更多信息?

Thanks! 谢谢!

Error message is: org.apache.commons.httpclient.HttpmethodDirector executeWithRetry INFO: I/O exception (java.net.ConnectException) caught when processing request: connection timed out: connect. 错误消息是:org.apache.commons.httpclient.HttpmethodDirector executeWithRetry信息:处理请求:连接超时:连接时捕获到I / O异常(java.net.ConnectException)。

They are running java jdk 1.6. 他们正在运行Java JDK 1.6。

protected String doGet(HttpClient httpClient, GetMethod getMethod)
throws IOException
 {
httpClient.getState().setCredentials(new AuthScope(this.host, this.port, null), new UsernamePasswordCredentials(this.username, this.password));
httpClient.getParams().setParameter("http.socket.timeout", new Integer(1000000));
getMethod.setDoAuthentication(true);
getMethod.getParams().setParameter("http.socket.timeout", new Integer(1000000));
getMethod.addRequestHeader("X-RallyIntegrationName", this.integrationName);
getMethod.addRequestHeader("X-RallyIntegrationVendor", this.integrationVendor);
getMethod.addRequestHeader("X-RallyIntegrationVersion", this.integrationVersion);
//getMethod.addRequestHeader("X-RallyIntegrationOS", getOSInfo());
//getMethod.addRequestHeader("X-RallyIntegrationPlatform", getProductInfo());
getMethod.addRequestHeader("X-RallyIntegrationLibrary", "Apache Commons HTTP Client 3.0");
try
{ 
  double timeBefore = System.currentTimeMillis() / 1000;
  int result = httpClient.executeMethod(getMethod);
  double timeAfter = System.currentTimeMillis() / 1000;
  System.out.println("Seconds to query for Workspace: " + (timeAfter - timeBefore));
  if (result != 200) {
    throw new IOException("Http GET Failed" + getMethod.getStatusLine());
  }
  String response = getMethod.getResponseBodyAsString();
  System.out.println(response);
  return response;
}
finally
{
  getMethod.releaseConnection();
}

} } }}

Can you use the Rally REST Toolkit for Java: https://github.com/RallyTools/RallyRestToolkitForJava 您可以使用Java的Rally REST工具包吗: https//github.com/RallyTools/RallyRestToolkitForJava

This handles a ton of the code you have written above (and is built using a newer version of the Apache Http Components- 4.2.x) 这处理了您上面编写的大量代码(并且是使用Apache Http Components 4.2.x的较新版本构建的)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 处理请求时捕获到 I/O 异常 (java.net.SocketException) - Getting I/O exception (java.net.SocketException) caught when processing request Tomcat 7 maven 插件 - 处理请求时捕获的 I/O 异常 (java.net.SocketException):管道损坏 - Tomcat 7 maven plugin - I/O exception (java.net.SocketException) caught when processing request: Broken pipe 处理对{}-> http:// IP:80的请求时捕获到I / O异常:打开的文件过多 - I/O exception caught when processing request to {}->http://IP:80: Too many open files Tomcat7 maven 插件 - 处理请求时捕获 I/O 异常 (java.net.SocketException):管道损坏 - Tomcat7 maven plugin - I/O exception (java.net.SocketException) caught when processing request: Broken pipe I/O 异常(java.io.IOException)在处理对{}的请求时捕获->unix://localhost:80:No such file or directory -when build image frm Dockerfile - I/O exception(java.io.IOException)caught when processing request to{}->unix://localhost:80:No such file or directory -when build image frm Dockerfile 连接超时java HttpClient库中的异常,但不是通过Chrome浏览器? - Connection timed out exception in java HttpClient library but not through chrome browser? 连接超时的 POST 请求的 I/O 错误; 嵌套异常是 java.net.SocketTimeoutException: 连接超时 - I/O error on POST request for Connect timed out; nested exception is java.net.SocketTimeoutException: Connect timed out 未为接受连接设置“超时时间”时,接受超时异常 - Accept timed out exception when not set “timeout time” for accept connections Apache HttpClient 读取一段时间后超时 - Apache HttpClient Read timed out after a while 具有客户端认证连接的HTTP客户端的SOAP请求超时异常 - SOAP Request with HTTP Client with client certification connection timed out Exception
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM