因此,我试图使用JerseyJiraRestClientFactory设置对JIRA的基本HTTP调用。我有所有的依赖,现在我有这个..。
public class SetUp {
public static void main(String[] args) throws Exception {
final NullProgressMonitor pm = new NullProgressMonitor();
final Console console = System.console();
if (console == null) {
System.out.println("Couldn't get Console instance");
System.exit(0);
}
String user = console.readLine("Enter your user name: ");
char[] password = console.readPassword("Enter your password: ");
char[] confirm = console.readPassword("Confirm password: ");
while (!(new String(password).equals(new String(confirm)))) {
console.printf("Error: Passwords do not match. Please Re-enter your password\n");
password = console.readPassword("Enter your password: ");
confirm = console.readPassword("Confirm password: ");
}
try {
JerseyJiraRestClientFactory f = new JerseyJiraRestClientFactory
System.out.println("\nafter 1");
JiraRestClient jc = f.createWithBasicHttpAuthentication(new URI(
"my_server"), user, new String(password));
System.out.println("\nafter 2");
Iterator<BasicProject> r = jc.getProjectClient().getAllProjects(pm).iterator();
System.out.println("\nafter 3");
int count = 0;
while (r.hasNext()) {
count++;
}
System.out.println("\nafter 4");
System.out.println("There are " + count + " issues.");
user = "";
Arrays.fill(password, ' ');
}
catch (com.atlassian.jira.rest.client.RestClientException e) {
System.out.println(e.getCause());
}
}
}所以这个错误就出现在打印“2”之后。我得到了这个错误代码
“线程中的异常”主“com.atlassian.jira.rest.client.RestClientException: com.sun.jersey.api.client.UniformInterfaceException:客户机响应状态: 500”
我试着打电话给不同的方法,结果都是相同的500。我也尝试使用不同的登录,包括有效的和无效的,它们都是500个。有人知道怎么解决这个问题吗?
发布于 2014-08-21 10:15:31
HTTP代码500是一个“内部服务器错误”,因此这与您的密码无关。(这应该会导致像401(未经授权的)或403(禁止的))有人在亚特兰西安论坛上问过类似的问题,请在这里查看:https://answers.atlassian.com/questions/263719/using-oauth-and-the-jira-java-rest-client。
https://stackoverflow.com/questions/25405044
复制相似问题