Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Getting a 500 error trying to create an issue using Java API

DJ Spiess
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 23, 2019

 

I'm trying to create an issue in JIRA using the jira-rest-java-client-core API (ver 

5.1.2-2bd0a62e).

 

The error I get back is:

com.atlassian.jira.rest.client.api.RestClientException [ErrorCollection{status=500, errors={}, errorMessages=[Internal server error]}]

 

I'm at a loss for what to correct, since the error isn't descriptive and implies it's on Atlassian's side.

 

private String createIssue(TicketRequestMessage message) {
log.info("Sending issue ");
String issueKey = "Empty";

try {
log.info("Get client");
IssueRestClient issueClient = jiraClient.getIssueClient();
    IssueInput newIssue = new IssueInputBuilder("DCST", TASK, message.getSummary())
    .setDescription(message.getDescription())
    .setPriorityId(PRIORITY_MEDIUM)
    .build();

    log.info("Create issue ");
    issueKey = issueClient.createIssue(newIssue).claim().getKey();
} catch (RestClientException e) {
log.error(e.getClass().getName() + " " +  e.getMessage());
e.getErrorCollections().stream().forEach(er -> {
er.getErrorMessages().stream().forEach(m -> {
log.error(m);
});
});
}

    log.info("Issue key: " + issueKey);
   return issueKey;
}

 

1 answer

1 accepted

0 votes
Answer accepted
Nir Haimov
Community Champion
April 23, 2019

Hi @DJ Spiess ,

Have you tried to create issue via REST API without the "jira-rest-java-client-core API" ?

Have you tried with "Postman" for example, or simply with "okhttp3" or "Unirest" libraries?

Also,
are you using Jira server or cloud?
Where are you trying to run your code from? (from Jira server or external WS)?

DJ Spiess
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 24, 2019

No, I the code had worked earlier and I assumed everything underneath was the same. Testing from Postman did help me track down the errors.

We moved to a company wide version of JIRA, and many of the keys had changed underneath me. The password auth didn't work, but an API key did. Fields in the issue were removed, etc. I think the 500 error went away when I used the correct key for a ticket type. After that I started getting 400 type errors with messages I could use. Thanks!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events