Can not login to Jira using Jira rest client sdk v2.0.0-m31 Edited

Hello team,

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();
		}
	}
}

 It seems to be some issue from Jira server side which is causing this problem. What can I do to fix this issue?

0 answers

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published yesterday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

39 views 0 3
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