Getting "JSONObject["loginInfo"] not found" error on trying to login using Jira rest client sdk Edited

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. Till friday morning we were able to login to Jira using mentioned Jira sdk(We have been using this sdk since last 1.5-2 years without any issue). But for some reason it started giving below error/exception when we try to login using 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

Below is sample piece of code which we are using to login to Jira using sdk:

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 = "hjethava";
		String email = "hjethava@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();
		}
	}
}

Can someone please help us here? 

2 answers

This widget could not be displayed.

Can someone help us with this issue? Let us know if more information is required.

I am also facing the same issue. I am blocked on this.

This widget could not be displayed.

Hi, 

This seems to be the same issue reported in:

However, as written in there, this is not going to be fixed since:

  1. Support for the IDE Connectors, including IntelliJ, was discontinued two years ago: https://developer.atlassian.com/blog/2015/06/discontinuing-ide-connectors-support/
  2. The JIRA rest Java client is not officially supported: https://marketplace.atlassian.com/plugins/com.atlassian.jira.jira-rest-java-client/server/overview 

 

However, the issue seems to be caused by the fact that the "logininfo" field is not returned anymore when calling the session endpoint. I have informed the developers about this, I will try to update this thread in case I get any update from their side.

 


Best Regards,
Dario
Atlassian Cloud Support

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 16 hours ago 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...

42 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