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 vote

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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,300 views 14 20
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot