Jira Rest Java Client Api ClassCastException

Andrei Iorga October 8, 2020

I am using jira rest java client and when I try to instantiate a JiraRestClient :

JiraRestClient client = factory.createWithBasicHttpAuthentication(uri, JIRA_ADMIN_USERNAME, JIRA_ADMIN_PASSWORD);

I get the following error:

java.langClassCastException: Cannot cast com.sun.jersey.core.impl.provider.header.LocaleProvider to com.sun.jersey.spi.HeaderDelegateProvider at java.lang.Class.cast(Class.java:3369)

 

And I don't understand why because both classes to which the error refers to are from jersey-core which is a compiled dependency of jira-rest-java-client-core that I am using -https://mvnrepository.com/artifact/com.atlassian.jira/jira-rest-java-client-core/5.2.1

 

Does anyone know why this error occurs and how can I fix it? Thank you.

1 answer

1 accepted

1 vote
Answer accepted
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 14, 2020

Hello @Andrei Iorga ,

I might not be the right person to answer this question here but, looking at the dependencies on the project page and the ones in the link you pointed out  I have noticed that jersey-core is not there anymore.

Indeed, in the project dependencies for version 5.2.1 only jersey-client and jersey-json are listed (jersey-core and jersey-apache-client are not there anymore):

  • atlassian-event
  • atlassian-httpclient-library
  • jira-rest-java-client-api
  • sal-api
  • jersey-client
  • jersey-json
  • atlassian-util-concurrent
  • joda-time
  • commons-lang3
  • slf4j-api
  • spring-beans

 

Can you try removing the unneeded dependency and see how it goes?

 

Also, are you actually using this for Jira Server or Cloud? In case this is for Cloud please keep in mind that JRJC is officially only supported for Jira Server even if many users are able to use it successfully with Cloud. For details see:

 

I hope this helps.

 

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events