1

I am trying to communicate with jira using Java but i am facing an exception as shown below

xception in thread "main" java.lang.NoSuchFieldError: INSTANCE at org.apache.http.impl.nio.conn.DefaultClientAsyncConnectionFactory.createHttpResponseFactory(DefaultClientAsyncConnectionFactory.java:105) at org.apache.http.impl.nio.conn.DefaultClientAsyncConnectionFactory.<init>(DefaultClientAsyncConnectionFactory.java:74) at org.apache.http.impl.nio.conn.DefaultClientAsyncConnectionFactory.<clinit>(DefaultClientAsyncConnectionFactory.java:62) at org.apache.http.impl.nio.conn.PoolingClientAsyncConnectionManager.createClientAsyncConnectionFactory(PoolingClientAsyncConnectionManager.java:96) at org.apache.http.impl.nio.conn.PoolingClientAsyncConnectionManager.<init>(PoolingClientAsyncConnectionManager.java:72) at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClient$2.<init>(DefaultHttpClient.java:117) at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClient.<init>(DefaultHttpClient.java:115) at com.atlassian.jira.rest.client.internal.async.AsynchronousHttpClientFactory.createClient(AsynchronousHttpClientFactory.java:53) at com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory.create(AsynchronousJiraRestClientFactory.java:35) at com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory.createWithBasicHttpAuthentication(AsynchronousJiraRestClientFactory.java:42) at jira.JiraCommunicate.main(JiraCommunicate.java:33) 

Exception i am facing at this line JiraRestClient client = factory.createWithBasicHttpAuthentication(uri, JIRA_ADMIN_USERNAME, JIRA_ADMIN_PASSWORD);

import java.net.URI; import java.net.URISyntaxException; import java.util.Arrays; import java.util.Collection; import com.atlassian.jira.rest.client.api.JiraRestClient; import com.atlassian.jira.rest.client.api.JiraRestClientFactory; import com.atlassian.jira.rest.client.api.domain.BasicProject; import com.atlassian.jira.rest.client.api.domain.Comment; import com.atlassian.jira.rest.client.api.domain.Issue; import com.atlassian.jira.rest.client.api.domain.SearchResult; import com.atlassian.jira.rest.client.api.domain.Transition; import com.atlassian.jira.rest.client.api.domain.User; import com.atlassian.jira.rest.client.api.domain.input.FieldInput; import com.atlassian.jira.rest.client.api.domain.input.TransitionInput; import com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory; import com.atlassian.util.concurrent.Promise; public class JiraCommunicate { private static final String JIRA_URL = ""; private static final String JIRA_ADMIN_USERNAME = ""; private static final String JIRA_ADMIN_PASSWORD = ""; public static void main(String[] args) throws Exception { // Construct the JRJC client //System.out.println(String.format("Logging in to %s with username '%s' and password '%s'", JIRA_URL, JIRA_ADMIN_USERNAME, JIRA_ADMIN_PASSWORD)); JiraRestClientFactory factory = new AsynchronousJiraRestClientFactory(); URI uri = new URI(JIRA_URL); JiraRestClient client = factory.createWithBasicHttpAuthentication(uri, JIRA_ADMIN_USERNAME, JIRA_ADMIN_PASSWORD); // Invoke the JRJC Client Promise<User> promise = client.getUserClient().getUser("admin"); User user = promise.claim(); for (BasicProject project : client.getProjectClient().getAllProjects().claim()) { System.out.println(project.getKey() + ": " + project.getName()); } Promise<SearchResult> searchJqlPromise = client.getSearchClient().searchJql("project = MYPURRJECT AND status in (Closed, Completed, Resolved) ORDER BY assignee, resolutiondate"); for (Issue issue : searchJqlPromise.claim().getIssues()) { System.out.println(issue.getSummary()); } // Print the result System.out.println(String.format("Your admin user's email address is: %s\r\n", user.getEmailAddress())); // Done System.out.println("Example complete. Now exiting."); System.exit(0); } } 

Blockquote

Please i need your help..I want to communicate Jira to upload or download Story or create bugs..

5
  • 3
    Do not attempt to post an image of the stack trace. Copy and paste the text. Commented Apr 9, 2018 at 7:41
  • Maybe stackoverflow.com/questions/5106520/… helps? Commented Apr 9, 2018 at 7:47
  • Possible duplicate of HTTPClient Example - Exception in thread "main" java.lang.NoSuchFieldError: INSTANCE Commented Apr 9, 2018 at 8:48
  • 1
    No ..its different...i am getting exception due to this line. JiraRestClient client = factory.createWithBasicHttpAuthentication(uri, JIRA_ADMIN_USERNAME, JIRA_ADMIN_PASSWORD); Commented Apr 9, 2018 at 11:13
  • I also got the same error at the same position of the code. Commented Jul 24, 2019 at 6:02

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.