Classcast exception: ProjectComponent to GenericValue Edited

In JIRA AMPS Version 6.2.11, I am getting classcastexception when I try to assign  ProjectComponent object to GenericValue. It was working before but giving issues with JIRA 7.5. Any suggestions please?

Here is the code and error

for (Iterator<ProjectComponent> compIterator = compCollection.iterator(); compIterator.hasNext();){

GenericValue component = (GenericValue);


java.lang.ClassCastException: com.atlassian.jira.bc.project.component.ProjectComponentImpl cannot be cast to org.ofbiz.core.entity.GenericValue

1 answer

0 vote

Hello Srinivas,

Why are you trying to cast "ProjectComponent" to GenericValue bean?

Since all over the APIs this approach seems to have been deprecated and it's mentioned not to use "GenericValue" rather use the "ProjectComponent" bean

convertToGenericValue(ProjectComponent projectComponent)Deprecated. don't use GenericValue use the ProjectComponent instead.

getGenericValue()This method is deprecated. use this object instead

GenericValue was used in some plugins that were developed long back and we are trying to refactor the code using the latest sdk. I replaced the GenericValue with ProjectComponent and that compiled successfully but for some reason the functionality is not working so I am looking if other way to achieve.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

575 views 6 12
Read article

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