connection error while using rest api



I'm trying to recive issues from JIRA by rest api and i got connection error when running the below code.

can anyone help ???

notice that i dont use internal server

are there any configuraion should i do?

please see exception below






    public class JiraConnection {



       public static void main(String[] args) throws Exception {


        JerseyJiraRestClientFactory f = new JerseyJiraRestClientFactory();

       JiraRestClient jc = f.createWithBasicHttpAuthentication(new URI(""), "", "1234567");


        SearchResult r = jc.getSearchClient().searchJql("type = Epic ORDER BY RANK ASC", null);


        Iterator<BasicIssue> it = r.getIssues().iterator();

        while (it.hasNext()) {


            Issue issue = jc.getIssueClient().getIssue(((BasicIssue), null);


            System.out.println("Epic: " + issue.getKey() + " " + issue.getSummary());


            Iterator<IssueLink> itLink = issue.getIssueLinks().iterator();

            while (itLink.hasNext()) {


                IssueLink issueLink = (IssueLink);

                Issue issueL = jc.getIssueClient().getIssue((issueLink).getTargetIssueKey(), null);


                System.out.println(issueLink.getIssueLinkType().getDescription() + ": " + issueL.getKey() + " " + issueL.getSummary() + " " + issueL.getField("Story Points"));








           private static Transition getTransitionByName(Iterable<Transition> transitions, String transitionName) {

               for (Transition transition : transitions) {

                   if (transition.getName().equals(transitionName)) {

                       return transition;



               return null;







Exception :-


Exception in thread "main" java.lang.NoSuchMethodError: com.sun.jersey.client.apache.ApacheHttpClientHandler.<init>(Lorg/apache/commons/httpclient/HttpClient;Lcom/sun/jersey/api/client/config/ClientConfig;)V





       at JiraConnection.main(


1 answer

0 votes

Your code is passing the wrong type of data into the connection handler, or you aren't importing the correct libraries for that call.

whats mean ??? can you please give example that work ???? also which user permission need for connection thanks

It means your code is doing something the library is not built for, it's making a call that can't be handled. I can't really tell you more than that, the error message is referring to code you have not posted. I can't give you an example that works, because I have no idea what you're doing here, and it's not the code that's failing anyway. Users trying to use REST have the same rights that they would get if they logged into the UI

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,294 views 5 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you