Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

JSONException when retrieving issue with JRJC

I try to retrieve an existing issue from Jira using Java Rest Client version 2.0.0-m2. That's the code:

104         IssueRestClient issueClient = null;
105         Issue issue = null;
106         Promise<Issue> promise = null;
107
108         try {
109             issueClient = getJiraClient().getIssueClient();
110             promise = issueClient.getIssue(issueId);
111             issue = promise.claim();
112             // issue = promise.get();

Method getJiraClient() returns a ready to use object which is initialized like this:

53         URI uri = null;
 54         JiraRestClientFactory factory = null;
 55
 56         try {
 57
 58             uri = new URI(getJiraUrl());
 59             LOG.debug("Trying to access " + uri);
 60
 61             factory = new AsynchronousJiraRestClientFactory();
 62             jiraClient = factory.createWithBasicHttpAuthentication(uri, getUser(), getPassword());
 63             setJiraClient(jiraClient);
 64             LOG.debug("Initialized Jira client " + getJiraClient());

However, while executing the first code snippet I get this JSONException in line 111 or 112 depending on what I use:

Caused by: com.atlassian.jira.rest.client.RestClientException: org.codehaus.jettison.json.JSONException: A JSONObject text must begin with '{' at character 0 of 
	at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$3.apply(AbstractAsynchronousRestClient.java:180)
	at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$3.apply(AbstractAsynchronousRestClient.java:1)
	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:285)
	at com.atlassian.util.concurrent.Promises$2.onSuccess(Promises.java:162)
	at com.google.common.util.concurrent.Futures$6.run(Futures.java:799)
	at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:262)

I didn't find an existing bug or any other questions here pointing to a solution. So any help is appreciated.

1 answer

1 accepted

1 vote
Answer accepted

OK. Actually this was an authentication error from Jira to our SSO infrastructure. :-( The exception was a little misleading in this case. However, my code seems correct.

Hi @Bernd Adamowicz ! I'm having the same issue. Were you able to find out the cause of the authentication error from Jira to your SSO infrastructure?

No, sorry. Ceased working on this issue many years ago.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you