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
Community showcase
Posted Friday in Jira Service Desk

Looking for anyone who has switched from Zendesk to Jira Service Desk

Hi Community! The Jira Service Desk marketing team is looking for customers who have successfully switched from Zendesk to Jira Service Desk!   We’d love to hear your thoughts on the pros and ...

94 views 6 2
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