我遇到了Jira Rest Client API的问题。 我使用广告WorkLog获得了例外:
com.atlassian.jira.rest.client.RestClientException:
at com.atlassian.jira.rest.client.internal.jersey.AbstractJerseyRestClient.invoke(AbstractJerseyRestClient.java:68)
at com.atlassian.jira.rest.client.internal.jersey.AbstractJerseyRestClient.post(AbstractJerseyRestClient.java:135)
at com.atlassian.jira.rest.client.internal.jersey.JerseyIssueRestClient.addWorklog(JerseyIssueRestClient.java:451)
at ConexionJira.main(ConexionJira.java:273)
Caused by: com.sun.jersey.api.client.UniformInterfaceException: Client response status: 404
at com.sun.jersey.api.client.WebResource.voidHandle(WebResource.java:707)
at com.sun.jersey.api.client.WebResource.post(WebResource.java:236)
at com.atlassian.jira.rest.client.internal.jersey.AbstractJerseyRestClient$6.call(AbstractJerseyRestClient.java:141)
at com.atlassian.jira.rest.client.internal.jersey.AbstractJerseyRestClient$6.call(AbstractJerseyRestClient.java:135)
at com.atlassian.jira.rest.client.internal.jersey.AbstractJerseyRestClient.invoke(AbstractJerseyRestClient.java:54)
我的代码是下一个:
public static void main (String[] args) throws URISyntaxException{
JerseyJiraRestClientFactory factory = new JerseyJiraRestClientFactory();
URI jiraServerUri = new URI("http://web.web.com/jira");
JiraRestClient restClient = factory.createWithBasicHttpAuthentication(jiraServerUri, "asd", "asd");
IssueRestClient irc = restClient.getIssueClient();
NullProgressMonitor pm = new NullProgressMonitor();
WorklogInput worklogInput = new WorklogInputBuilder(tarea.getSelf())
.setStartDate(new DateTime())
.setComment("Comment for my worklog.")
.setMinutesSpent(1)
.build();
Issue issue = restClient.getIssueClient().getIssue("ISSUE", pm);
irc.addWorklog(issue.getWorklogUri(), worklogInput , pm);
有人能帮帮我吗?感谢。
答案 0 :(得分:1)
两件事,确保URI正确。 web.web.com/jira似乎是一个不正确的jira网址。
此外,如果您的服务器具有自签名证书,请确保将其导入密钥库。
404几乎可以肯定你正在使用的URI。