package runner;
import java.sql.*;
import java.net.URI;
import com.sun.jersey.client.apache.config.*;
import com.sun.jersey.api.client.*;
import javax.ws.rs.core.*;
import org.codehaus.jettison.json.*;
import com.sun.jersey.core.util.*;
import org.apache.commons.httpclient.*;
import org.apache.commons.logging.*;
import com.google.common.base.*;
import com.google.common.collect.*;
import org.apache.commons.codec.*;
import com.atlassian.jira.rest.client.*;
import com.atlassian.jira.rest.client.domain.*;
import com.atlassian.jira.rest.client.internal.jersey.*;
public class run {
public static void main(String args[]){
try{
JerseyJiraRestClientFactory factory = new JerseyJiraRestClientFactory();
//URI jiraServerUri = new URI("http://10.4.16.75:8090/jira");
//URI jiraServerUri = new URI("http://10.2.76.80:8090/jira");
URI jiraServerUri = new URI("http://10.2.42.82:8090/jira");
JiraRestClient restClient = factory.createWithBasicHttpAuthentication(jiraServerUri, "qingbo.meng", "32243399");
NullProgressMonitor pm = new NullProgressMonitor();
Issue issue = restClient.getIssueClient().getIssue("TES-1", pm);
//System.out.println(issue);
System.out.println("************************************");
return;
}catch(Exception e){
System.out.println(e.toString());
}
}
}
这是我的代码,想要显示一条指定的issue,就是有下面提示:
2012-12-6 20:44:19 org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
信息: I/O exception (java.net.ConnectException) caught when processing request: Connection refused: connect
2012-12-6 20:44:19 org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
信息: Retrying request
------解决思路----------------------
可能是你某个HTTP request的参数没有设置正确
找个工具从浏览器抓个HTTP包看看,就一清二楚了