Atlassian JIRA Java REST API Fugue problem

Viewed 1819

I want to fetch data from a JIRA server using a simple Java program.

I got this in my POM, after trying a lot of different solutions found here and there.

<repositories>
    <repository>
        <id>atlassian-public</id>
        <url>https://packages.atlassian.com/maven/repository/public</url>
    </repository>
    <repository>
        <id>atlassian-public</id>
        <url>https://mvnrepository.cpm/artifact/com.atlassian.fugue/fugue</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-rest-java-client-core</artifactId>
        <version>5.2.0</version>
    </dependency>
    <dependency>
        <groupId>io.atlassian.fugue</groupId>
        <artifactId>fugue</artifactId>
        <version>4.7.2</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

My project builds, but when I run it I get the problem description below. I believe the simple logger is a warning, but what should I have done for io.atlassian.fugue to be found during runtime?

best rgds,

Niklas

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.NoClassDefFoundError: io/atlassian/fugue/Suppliers at com.atlassian.httpclient.apache.httpcomponents.ApacheAsyncHttpClient.(ApacheAsyncHttpClient.java:80) at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClientFactory.doCreate(DefaultHttpClientFactory.java:61) at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClientFactory.create(DefaultHttpClientFactory.java:36) at com.atlassian.jira.rest.client.internal.async.AsynchronousHttpClientFactory.createClient(AsynchronousHttpClientFactory.java:65) at com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory.create(AsynchronousJiraRestClientFactory.java:36) at com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory.createWithAuthenticationHandler(AsynchronousJiraRestClientFactory.java:47) at MyJiraClient.getJiraRestClient(MyJiraClient.java:44) at MyJiraClient.(MyJiraClient.java:27) at MyJiraClient.main(MyJiraClient.java:31) Caused by: java.lang.ClassNotFoundException: io.atlassian.fugue.Suppliers at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ... 9 more

2 Answers

This probably is an issue with the jira-rest-java-client-core (JRJC) and io.atlassian.fugue versions not working together. JRJC needs fugue, but you need to use the right version of fugue together with a given version of JRJC.

I've also struggled with this, but I haven't found anywhere / any way to figure out which fugue version actually works well with the newest JRJC version other than trying (and failing). I followed an example at Baeldung, but the JRJC version used there was old (4.0.0) so I wanted to use something newer.

Through trial and error, I found that these versions work well together, but the JRJC version is not the newest one, though:

<dependency>
    <groupId>com.atlassian.jira</groupId>
    <artifactId>jira-rest-java-client-core</artifactId>
    <version>5.1.0</version>
</dependency>

<dependency>
    <groupId>io.atlassian.fugue</groupId>
    <artifactId>fugue</artifactId>
    <version>4.7.2</version>
</dependency>

Note also that there is (as shown in the Baeldung example) a fugue artifact with groupId com.atlassian.fugue (instead of io.atlassian.fugue).

Fistly, the SLF4J: Failed to load class warning, I think is different to your main error, you can clean or fix the warning adding a SLF4J Bridge maven dependency:

 <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>2.13.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>2.13.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-slf4j-impl</artifactId>
        <version>2.13.3</version>
    </dependency>
 

And later you can analyze the other root problem.

Related