Not able to create a JiraRestClient

Yasin Bhojawala September 24, 2017

I am trying to create a JiraRestClient using Basic authentication.

JiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();

URI jiraServerUri = getJiraUri();
JiraRestClient restClient = factory
.createWithBasicHttpAuthentication(jiraServerUri, USERNAME, PASSWORD);

 However, I am getting the below exception:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.NoSuchMethodError: com.atlassian.fugue.Option.fold(Lcom/google/common/base/Supplier;Lcom/google/common/base/Function;)Ljava/lang/Object;
at com.atlassian.httpclient.apache.httpcomponents.proxy.ProxyConfigFactory.getProxyHost(ProxyConfigFactory.java:16)
at com.atlassian.httpclient.apache.httpcomponents.ApacheAsyncHttpClient.<init>(ApacheAsyncHttpClient.java:211)
at com.atlassian.httpclient.apache.httpcomponents.ApacheAsyncHttpClient.<init>(ApacheAsyncHttpClient.java:123)
at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClientFactory.doCreate(DefaultHttpClientFactory.java:68)
at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClientFactory.create(DefaultHttpClientFactory.java:35)
at com.atlassian.jira.rest.client.internal.async.AsynchronousHttpClientFactory.createClient(AsynchronousHttpClientFactory.java:63)
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 com.jira.JiraClient.getJiraRestClient(JiraClient.java:37)
at com.jira.JiraClient.getIssue(JiraClient.java:25)
at com.jira.JiraClient.main(JiraClient.java:20)

Below is my Pom.xml:

<dependencies>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-rest-java-client-core</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.atlassian.fugue</groupId>
<artifactId>fugue</artifactId>
<version>3.0.0-m007</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>atlassian-public</id>
<url>https://packages.atlassian.com/maven/repository/public</url>
</repository>
</repositories> 

 

3 answers

1 accepted

2 votes
Answer accepted
Yasin Bhojawala September 28, 2017

The version of fugue compatible with JRJC 4.0.0is 2.6.1

<dependency>
    <groupId>com.atlassian.fugue</groupId>
    <artifactId>fugue</artifactId>
    <version>2.6.1</version>
</dependency>
0 votes
Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 25, 2017

Try adding the binding jar file

 

<dependency>
 <groupId>org.slf4j</groupId>
 <artifactId>slf4j-jdk14</artifactId>
 <version>1.7.25</version>
</dependency>
0 votes
Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 24, 2017

The dependencies seem correct. Have you tried making sure that you do a maven clean and then repackage the code?

Yasin Bhojawala September 24, 2017

Yeah, I did that just now, no luck.

Suggest an answer

Log in or Sign up to answer