java.lang.ClassCastException: com.atlassian.jira.issue.issuetype.IssueTypeImpl cannot be cast to org.ofbiz.core.entity.GenericValue

Atlassian JIRA | David [Innovalog] | 10 months ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    If you configure a Two Dimensional Filter Statistics Gadget to display on its YAxis a custom field, and that custom field is restricted to certain Issue Types (using the "Configure" action on the custom field), then the gadget displays an error and the following is found in the logs: {code} 2016-03-30 08:55:25,931 ERROR /rest/gadget/1.0/statistics [c.a.p.r.c.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: com.atlassian.jira.issue.issuetype.IssueTypeImpl cannot be cast to org.ofbiz.core.entity.GenericValue java.lang.ClassCastException: com.atlassian.jira.issue.issuetype.IssueTypeImpl cannot be cast to org.ofbiz.core.entity.GenericValue at com.atlassian.jira.util.ofbiz.GenericValueUtils.transformToStringIds(GenericValueUtils.java:67) at com.atlassian.jira.util.ofbiz.GenericValueUtils.transformToStringIdsList(GenericValueUtils.java:86) at com.atlassian.jira.issue.customfields.statistics.AbstractCustomFieldStatisticsMapper.getSearchContextFromValue(AbstractCustomFieldStatisticsMapper.java:94) at com.atlassian.jira.issue.customfields.statistics.AbstractCustomFieldStatisticsMapper.getSearchUrlSuffix(AbstractCustomFieldStatisticsMapper.java:50) at com.atlassian.jira.dashboarditem.statistics.service.statistics.searcher.StatisticsSearcher$StatisticMapperWrappingSearchRequestAppender.appendInclusiveSingleValueClause(StatisticsSearcher.java:173) at com.atlassian.jira.dashboarditem.statistics.service.statistics.searcher.StatisticsSearcher.completeOneDimensionalSearch(StatisticsSearcher.java:132) at com.atlassian.jira.dashboarditem.statistics.service.statistics.searcher.StatisticsSearcher.completeOneDimensionalSearch(StatisticsSearcher.java:81) at com.atlassian.jira.dashboarditem.statistics.service.statistics.StatisticsServiceImpl.aggregateOneDimensionalStats(StatisticsServiceImpl.java:98) at com.atlassian.jira.dashboarditem.statistics.rest.StatisticsResource.oneDimensionalSearchWithJql(StatisticsResource.java:130) at com.atlassian.jira.dashboarditem.statistics.rest.StatisticsResource.oneDimensionalSearchForFilter(StatisticsResource.java:109) at com.atlassian.jira.dashboarditem.statistics.rest.StatisticsResource.oneDimensionalSearch(StatisticsResource.java:77) ... 2 filtered at java.lang.reflect.Method.invoke(Method.java:497) ... 18 filtered at com.atlassian.plugins.rest.module.RestDelegatingServletFilter$JerseyOsgiServletContainer.doFilter(RestDelegatingServletFilter.java:178) ... 1 filtered at com.atlassian.plugins.rest.module.RestDelegatingServletFilter.doFilter(RestDelegatingServletFilter.java:73) ... 110 filtered at com.atlassian.plugins.rest.module.servlet.RestSeraphFilter.doFilter(RestSeraphFilter.java:40) ... 72 filtered at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) {code} This is due to a bug in com.atlassian.jira.issue.customfields.statistics.AbstractCustomFieldStatisticsMapper#getSearchContextFromValue: {code} protected SearchContext getSearchContextFromValue(Object value) { [...] List associatedIssueTypes = customField.getAssociatedIssueTypes(); // <-- notice the generic List? if (associatedIssueTypes != null && !associatedIssueTypes.isEmpty() && associatedIssueTypes.get(0) != null) { issueTypeIds = GenericValueUtils.transformToStringIdsList(associatedIssueTypes); // <-- Oops! customField.getAssociatedIssueTypes now returns a List<IssueType>, not a List<GenericValue> anymore. So you cannot call GenericValueUtils.transformToStringIdsList on it. But since associatedIssueTypes is a List and not a List<GenericValue>, you don't see the error at compilation time... } [...] } {code}

    Atlassian JIRA | 10 months ago | David [Innovalog]
    java.lang.ClassCastException: com.atlassian.jira.issue.issuetype.IssueTypeImpl cannot be cast to org.ofbiz.core.entity.GenericValue
  2. 0

    If you configure a Two Dimensional Filter Statistics Gadget to display on its YAxis a custom field, and that custom field is restricted to certain Issue Types (using the "Configure" action on the custom field), then the gadget displays an error and the following is found in the logs: {code} 2016-03-30 08:55:25,931 ERROR /rest/gadget/1.0/statistics [c.a.p.r.c.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: com.atlassian.jira.issue.issuetype.IssueTypeImpl cannot be cast to org.ofbiz.core.entity.GenericValue java.lang.ClassCastException: com.atlassian.jira.issue.issuetype.IssueTypeImpl cannot be cast to org.ofbiz.core.entity.GenericValue at com.atlassian.jira.util.ofbiz.GenericValueUtils.transformToStringIds(GenericValueUtils.java:67) at com.atlassian.jira.util.ofbiz.GenericValueUtils.transformToStringIdsList(GenericValueUtils.java:86) at com.atlassian.jira.issue.customfields.statistics.AbstractCustomFieldStatisticsMapper.getSearchContextFromValue(AbstractCustomFieldStatisticsMapper.java:94) at com.atlassian.jira.issue.customfields.statistics.AbstractCustomFieldStatisticsMapper.getSearchUrlSuffix(AbstractCustomFieldStatisticsMapper.java:50) at com.atlassian.jira.dashboarditem.statistics.service.statistics.searcher.StatisticsSearcher$StatisticMapperWrappingSearchRequestAppender.appendInclusiveSingleValueClause(StatisticsSearcher.java:173) at com.atlassian.jira.dashboarditem.statistics.service.statistics.searcher.StatisticsSearcher.completeOneDimensionalSearch(StatisticsSearcher.java:132) at com.atlassian.jira.dashboarditem.statistics.service.statistics.searcher.StatisticsSearcher.completeOneDimensionalSearch(StatisticsSearcher.java:81) at com.atlassian.jira.dashboarditem.statistics.service.statistics.StatisticsServiceImpl.aggregateOneDimensionalStats(StatisticsServiceImpl.java:98) at com.atlassian.jira.dashboarditem.statistics.rest.StatisticsResource.oneDimensionalSearchWithJql(StatisticsResource.java:130) at com.atlassian.jira.dashboarditem.statistics.rest.StatisticsResource.oneDimensionalSearchForFilter(StatisticsResource.java:109) at com.atlassian.jira.dashboarditem.statistics.rest.StatisticsResource.oneDimensionalSearch(StatisticsResource.java:77) ... 2 filtered at java.lang.reflect.Method.invoke(Method.java:497) ... 18 filtered at com.atlassian.plugins.rest.module.RestDelegatingServletFilter$JerseyOsgiServletContainer.doFilter(RestDelegatingServletFilter.java:178) ... 1 filtered at com.atlassian.plugins.rest.module.RestDelegatingServletFilter.doFilter(RestDelegatingServletFilter.java:73) ... 110 filtered at com.atlassian.plugins.rest.module.servlet.RestSeraphFilter.doFilter(RestSeraphFilter.java:40) ... 72 filtered at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) {code} This is due to a bug in com.atlassian.jira.issue.customfields.statistics.AbstractCustomFieldStatisticsMapper#getSearchContextFromValue: {code} protected SearchContext getSearchContextFromValue(Object value) { [...] List associatedIssueTypes = customField.getAssociatedIssueTypes(); // <-- notice the generic List? if (associatedIssueTypes != null && !associatedIssueTypes.isEmpty() && associatedIssueTypes.get(0) != null) { issueTypeIds = GenericValueUtils.transformToStringIdsList(associatedIssueTypes); // <-- Oops! customField.getAssociatedIssueTypes now returns a List<IssueType>, not a List<GenericValue> anymore. So you cannot call GenericValueUtils.transformToStringIdsList on it. But since associatedIssueTypes is a List and not a List<GenericValue>, you don't see the error at compilation time... } [...] } {code}

    Atlassian JIRA | 10 months ago | David [Innovalog]
    java.lang.ClassCastException: com.atlassian.jira.issue.issuetype.IssueTypeImpl cannot be cast to org.ofbiz.core.entity.GenericValue

    Root Cause Analysis

    1. java.lang.ClassCastException

      com.atlassian.jira.issue.issuetype.IssueTypeImpl cannot be cast to org.ofbiz.core.entity.GenericValue

      at com.atlassian.jira.util.ofbiz.GenericValueUtils.transformToStringIds()
    2. com.atlassian.jira
      StatisticsResource.oneDimensionalSearch
      1. com.atlassian.jira.util.ofbiz.GenericValueUtils.transformToStringIds(GenericValueUtils.java:67)
      2. com.atlassian.jira.util.ofbiz.GenericValueUtils.transformToStringIdsList(GenericValueUtils.java:86)
      3. com.atlassian.jira.issue.customfields.statistics.AbstractCustomFieldStatisticsMapper.getSearchContextFromValue(AbstractCustomFieldStatisticsMapper.java:94)
      4. com.atlassian.jira.issue.customfields.statistics.AbstractCustomFieldStatisticsMapper.getSearchUrlSuffix(AbstractCustomFieldStatisticsMapper.java:50)
      5. com.atlassian.jira.dashboarditem.statistics.service.statistics.searcher.StatisticsSearcher$StatisticMapperWrappingSearchRequestAppender.appendInclusiveSingleValueClause(StatisticsSearcher.java:173)
      6. com.atlassian.jira.dashboarditem.statistics.service.statistics.searcher.StatisticsSearcher.completeOneDimensionalSearch(StatisticsSearcher.java:132)
      7. com.atlassian.jira.dashboarditem.statistics.service.statistics.searcher.StatisticsSearcher.completeOneDimensionalSearch(StatisticsSearcher.java:81)
      8. com.atlassian.jira.dashboarditem.statistics.service.statistics.StatisticsServiceImpl.aggregateOneDimensionalStats(StatisticsServiceImpl.java:98)
      9. com.atlassian.jira.dashboarditem.statistics.rest.StatisticsResource.oneDimensionalSearchWithJql(StatisticsResource.java:130)
      10. com.atlassian.jira.dashboarditem.statistics.rest.StatisticsResource.oneDimensionalSearchForFilter(StatisticsResource.java:109)
      11. com.atlassian.jira.dashboarditem.statistics.rest.StatisticsResource.oneDimensionalSearch(StatisticsResource.java:77)
      11 frames