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

Java Rest Client hanging on createIssue request forever? Edited

val issueInput = IssueInputBuilder()
.setProjectKey(PROJECT_KEY)
.setSummary(title)
.setIssueTypeId(getIssueType(request.feedbackType))
.setDescription(description)
.build()

logger.info("About to send jira createIssue request $description") // Log 1
val basicIssuePromise = issueClient.createIssue(issueInput)
logger.info("create Issue request sent, waiting for promise. Promise = $basicIssuePromise") // Log 2

val bi = basicIssuePromise.claim() 
logger.info("Claim worked and got the issue response = $bi") // Log 3

return bi

 

This is the code that causes problems. In the service, I am only seeing Log 1 get printed as output, and no exception is thrown. This leads me to think that the `createIssue` method is hanging, or killing the thread.


This started happening kind of suddenly, it seemed to work fine for several hundred tickets, but now does not work.

Any insight into why this is happening would be appreciated. Thanks!

 

 

 

 

1 answer

1 accepted

0 votes
Answer accepted

Hello @Brandon Xia ,

Welcome to the Atlassian Community!

I am not sure what Java Rest Client you are using and I don't know much about the implementation details (e.g. authentication method used, etc) since this information has not been provided so far.

However, in order to determine whether the issue is with the REST API endpoint or with your code you can send the same request to the Create issue REST API endpoint using Curl and see if this works or if it hangs as well. 

Something like the following example (assuming you use API Tokens to authenticate):

curl -u <EMAIL-ADDRESS>:<API-TOKEN> -D- -H 'Accept: application/json' -H 'Content-Type: application/json' --data '{"fields":{"project":{"key":"<PROJECT-KEY>"},"summary":"create issue","issuetype":{"name":"Task","subtask":false},"priority":{"name":"Medium"}}}' -X POST "http://<NAME>.atlassian.net/rest/api/3/issue" 

 

Please run the same test on your side replacing <EMAIL-ADDRESS>, <API-TOKEN> and <NAME> with the right values and replacing the JSON payload (the one after --data) with the one you send from your Java application.

If this fails as well please paste the console output in your reply (making sure to hide the sensitive data) and let me know date time and timezone you tested this so that I can go check your Jira site logs.

 

 

 

Cheers,
Dario

Hi Dario, 

I was using the library: com.atlassian.jira:jira-rest-java-client-app:5.2.2. I was originally on 5.2.0, then I switched to 5.2.2 and the problems persisted.

 

I was able to make the api request through curl successfully with response 201.

I suspect this isn't an auth problem, as it was working for a few weeks, and stopped suddenly.

 

I hope this gives you enough info to debug -

The cURL request I just made's response (successful):

HTTP/2 201
server: AtlassianProxy/1.15.8.1
cache-control: no-cache, no-store, no-transform
content-type: application/json;charset=UTF-8
strict-transport-security: max-age=315360000; includeSubDomains; preload
date: Fri, 26 Mar 2021 16:33:36 GMT
atl-traceid: 7068a3f245416945
x-arequestid: 99684d2d-0764-4984-a95d-f8e5daf5bbf7
x-aaccountid: 602d93a61bf1ce006bb704d8
x-xss-protection: 1; mode=block
timing-allow-origin: *
x-envoy-upstream-service-time: 831
x-content-type-options: nosniff
micros-issuer: micros/edge-authenticator
set-cookie: atlassian.xsrf.token=xxxxxxxxx Path=/; Secure
expect-ct: report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/global-proxy", enforce, max-age=86400

Here are some timestamps that I know some requests were made but never resolved: (UTC Time)

2021-03-24T12:08:23.416Z
2021-03-24T12:08:24.265Z

 

Thank you,

Brandon

Hello @Brandon Xia ,

I might not be the best person to answer development related issues, however:

  1. If the call works fine with curl but it fails from your code, the issue is either with the library you are using or with your code. Have you tried comparing the data sent while using curl and the one sent by your code (endpoints, methods, headers, payload, etc)?
  2. If you are actually using the Jira Rest Java Client (JRJC) then please notice that this is not supposed to work with Jira Cloud (Server only): https://ecosystem.atlassian.net/wiki/spaces/JRJC/overview

 

Finally, for the future, please notice that this is not the best place to get help on development  related questions. The right resources are listed in https://developer.atlassian.com/resources. 

Specifically:

 

Cheers,
Dario

Thanks for the reply. Yes I think it is something wrong with either my code or the library. 

I have decided to just move away from the JRJC Library and use a regular http client to make the requests. It appears to be more stable.

 

Thanks for the resources too, Dario!

Brandon

Dario B Atlassian Team Mar 31, 2021

You are very welcome @Brandon Xia ,

I actually had to correct my previous reply, in there I wanted to write that JRJC is built to work with Jira Server only and that's why it might not work with some Jira Cloud REST API endpoints.

Have a nice weekend!

Dario

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
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