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 Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

Meet the AUG leaders of Northern Virginia

@Rachel Wright (Jira Genie), @Billy Poggi (AUG NOVA, DC), and @Dana Jansen (Confluence Queen) are just some of the folks that lead one of the world's most active Atlassian User Group (AUG)....

125 views 4 9
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