Cannot login to JIRA using JIRA REST Java client JRJC

We are using Jira rest client sdk(jira-rest-java-client-api-2.0.0-m31.jar and jira-rest-java-client-core-2.0.0-m31.jar) for login and fetching data from Jira as follows:

package com.jira;

import java.net.URI;

import com.atlassian.jira.rest.client.api.JiraRestClient;
import com.atlassian.jira.rest.client.api.domain.Session;
import com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory;

public class JiraLogin {
                private static final AsynchronousJiraRestClientFactory FACTORY = new AsynchronousJiraRestClientFactory();
                
                public static void main(String args[]){
                                String url = "https://mycompany.atlassian.net";
                                String username = "user";
                                String email = "user@xyzcompany.com";
                                String password = "xxxxx";
                                
                                try {
                                                URI serverURI = new URI(url);
                                                JiraRestClient jrc = FACTORY.createWithBasicHttpAuthentication(serverURI, email, password);
                                                Session s = jrc.getSessionClient().getCurrentSession().claim();
                                                username = s.getUsername();
                                                System.out.println("User '" + username + "' logged in successfully.");
                                } catch (Exception e) {
                                                e.printStackTrace();
                                }
                }
}

Till friday morning, we were able to login to Jira using the code mentioned above. Now, it has started giving below error/exception when we try to login using the same sdk:

RestClientException{statusCode=Optional.absent(), errorCollections=[]}
                at com.atlassian.jira.rest.client.internal.async.DelegatingPromise.claim(DelegatingPromise.java:47)
                at com.jira.JiraLogin.main(JiraLogin.java:21)
Caused by: RestClientException{statusCode=Optional.absent(), errorCollections=[]}
                at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$3.apply(AbstractAsynchronousRestClient.java:181)
                at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$3.apply(AbstractAsynchronousRestClient.java:175)
                at com.atlassian.httpclient.api.ResponsePromiseMapFunction.apply(ResponsePromiseMapFunction.java:62)
                at com.atlassian.httpclient.api.ResponsePromiseMapFunction.apply(ResponsePromiseMapFunction.java:12)
                at com.atlassian.util.concurrent.Promises$Of$3.apply(Promises.java:268)
                at com.atlassian.util.concurrent.Promises$2.onSuccess(Promises.java:158)
                at com.google.common.util.concurrent.Futures$6.run(Futures.java:1319)
                at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:457)
                at com.google.common.util.concurrent.ExecutionList.executeListener(ExecutionList.java:156)
                at com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:145)
                at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:185)
                at com.google.common.util.concurrent.SettableFuture.set(SettableFuture.java:53)
                at com.atlassian.util.concurrent.Promises$Of$3.apply(Promises.java:268)
                at com.atlassian.util.concurrent.Promises$2.onSuccess(Promises.java:158)
                at com.google.common.util.concurrent.Futures$6.run(Futures.java:1319)
                at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:457)
                at com.google.common.util.concurrent.ExecutionList.executeListener(ExecutionList.java:156)
                at com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:145)
                at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:185)
                at com.google.common.util.concurrent.SettableFuture.set(SettableFuture.java:53)
                at com.atlassian.httpclient.apache.httpcomponents.SettableFuturePromiseHttpPromiseAsyncClient$1$1.run(SettableFuturePromiseHttpPromiseAsyncClient.java:46)
                at com.atlassian.httpclient.apache.httpcomponents.SettableFuturePromiseHttpPromiseAsyncClient$ThreadLocalDelegateRunnable$1.run(SettableFuturePromiseHttpPromiseAsyncClient.java:197)
                at com.atlassian.httpclient.apache.httpcomponents.SettableFuturePromiseHttpPromiseAsyncClient.runInContext(SettableFuturePromiseHttpPromiseAsyncClient.java:90)
                at com.atlassian.httpclient.apache.httpcomponents.SettableFuturePromiseHttpPromiseAsyncClient$ThreadLocalDelegateRunnable.run(SettableFuturePromiseHttpPromiseAsyncClient.java:192)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
                at java.lang.Thread.run(Unknown Source)
Caused by: org.codehaus.jettison.json.JSONException: JSONObject["loginInfo"] not found.
                at org.codehaus.jettison.json.JSONObject.get(JSONObject.java:360)
                at org.codehaus.jettison.json.JSONObject.getJSONObject(JSONObject.java:454)
                at com.atlassian.jira.rest.client.internal.json.SessionJsonParser.parse(SessionJsonParser.java:33)
                at com.atlassian.jira.rest.client.internal.json.SessionJsonParser.parse(SessionJsonParser.java:26)
                at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$1.handle(AbstractAsynchronousRestClient.java:138)
                at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$3.apply(AbstractAsynchronousRestClient.java:179)
                ... 26 more

Looks like something has changed on JIRA server side. Can someone fix it? Or any alternatives for the login?

1 answer

0 votes

Same issue. Any solutions?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Monday in Jira Ops

Jira Ops Early Access Program Update #1: Announcing our next feature and a new integration

Thanks for signing up for Jira Ops! I’m Matt Ryall, leader for the Jira Ops product team at Atlassian. Since this is a brand new product, we’ll be delivering improvements quickly and sharing updates...

415 views 0 8
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