Unable to connect to Jira using Java ..need urgent help

final HttpClient httpClient = new AsynchronousHttpClientFactory().createClient(serverUri, authenticationHandler);

Exception in thread "main" java.lang.NoClassDefFoundError: com/atlassian/sal/api/ApplicationProperties

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:41)

2 answers

1 accepted

0 vote

You are not using a "simple java program" here. You are using a pre-written library that already handles a lot of the connection stuff, and the error you are getting is a common one for people who have just picked it up and thought "I don't need to understand this stuff, I can just start using it without reading how to use it or what it's actually for".

Your best option is to work within the Atlassian SDK, which includes the dependencies you need for using JRJC, or you need to understand what you need to pull in the right dependencies. My bookmarks contain https://ecosystem.atlassian.net/wiki/display/JRJC/Downloadfor understanding that, and a note to include com.atlassian.sal in the pom.xml

Thank you for your help. I'll go through what you suggested.

0 vote

You haven't imported the application properties class, or you've not included the library in your class path.

Thank you for your help. Can you please suggest me what library I need to include ?

The one containing the application properties class.

Diffficult to tell you though - we don't know where your code is actually running. Plugin, connect, externally etc?


Thiss my method which I'm calling from a class and I'm doing this in eclipse.

public JiraIssueAgent(JiraConfig config) throws URISyntaxException {

JiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();

URI jiraServerUri = new URI(config.getUrl());

JiraRestClient restClient = factory.createWithBasicHttpAuthentication(jiraServerUri, config.getUsername(), config.getPassword());

init(restClient);

}

Please suggest me the necessary libraries to include..

No, sorry, I was not clear when I said we don't know *where* your code is running.

Is it a plugin/addon for Jira? A "Connect" addon? A hack in the core of Jira? A gadget? An external program (Which won't need the the library, because it's outside Jira)?

Thank you for your patience. It's An external program trying to connect to Jira with a login user and password

JiraRestClient restClient = factory.createWithBasicHttpAuthentication(jiraServerUri, config.getUsername(), config.getPassword());

this lines returns me an error syaing Exception in thread "main" java.lang.NoClassDefFoundError: com/atlassian/sal/api/ApplicationProperties

what is this com/atlassian/sal How should I get this.

You don't need the com/atlassian/sal stuff for external programs. You connect via REST and get JSON formatted responses back.

Thank you for your help.

I'm connecting through Rest client only . I'm using following .jars to run my code.

jira-rest-java-client-2.0.0-m2

atlassian-util-concurrent-2.4.1.

Please help me i'm stuck with this. I've read data from Jira

I'm exactly having a problem like below. Not sure how Joe resolved this. My code i've not used any maven plugins..Please suggest. How to connect to jira from a simple java simple java program and required references and corresponding pom.xml file please

https://answers.atlassian.com/questions/316728/java-lang-noclassdeffounderror-com-atlassian-sal-api-applicationproperties

Hi @Hari Krishna2, what turned out to be solution for you? I am having similar issue.

They used the REST API as documented.

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
Posted Tuesday in Uncategorized

Friday fun: how many celebrates Midsummer holiday or is this a Swedish tradition only?

Any other country that celebrates Midsummer holiday (this friday 22 June)?  

36 views 3 1
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