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

This widget could not be displayed.

Same issue. Any solutions?

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

97 views 1 0
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