How to Fix Issue Creation Failure After Jira Upgrade Due to ClassCastException

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Fail to create an issue (no error in the UI) and the following appears in the atlassian-jira.log:

2012-11-07 12:01:53,289 http-8080-2 ERROR [500ErrorPage.jsp] Exception caught in 500 page java.lang.String cannot be cast to java.lang.Long java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long at com.atlassian.jira.issue.customfields.impl.MultiSelectCFType.getDefaultValue(MultiSelectCFType.java:166) at com.atlassian.jira.issue.customfields.impl.MultiSelectCFType.getDefaultValue(MultiSelectCFType.java:71) at com.atlassian.jira.issue.fields.CustomFieldImpl.populateDefaults(CustomFieldImpl.java:580) ...

Diagnosis

This error typically occurs after a Jira upgrade when there are incompatible or obsolete plugins present. The log shows a java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long, and users are unable to create new issues, often with no visible error in the UI. The root cause is usually a plugin JAR

Cause

The default value of the Multiselect or Select Custom Field is not migrated to a correct format in the database

Solution

  • Search for the invalid default value by running this query (select the one that corresponds to your database type. For HSQL, you can use the MySQL syntax):

    For MySQL

    SELECT * FROM genericconfiguration where DATAKEY IN (SELECT b.id FROM customfield a, fieldconfiguration b where b.FIELDID=INSERT('customfield_',13,5,a.id) AND CUSTOMFIELDTYPEKEY like '%select%') AND xmlvalue like'%<string>%';

    For PSQL

    SELECT * FROM genericconfiguration where datakey IN (SELECT CAST (b.id AS CHAR (10)) FROM customfield a, fieldconfiguration b where b.FIELDID=CONCAT('customfield_',a.id) AND CUSTOMFIELDTYPEKEY like '%select%') AND xmlvalue like'%<string>%';

    For Oracle

    SELECT * FROM genericconfiguration where DATAKEY IN(SELECT b.id FROM customfield a, fieldconfiguration b where b.FIELDID='customfield_'|| a.id AND CUSTOMFIELDTYPEKEY like '%select%') AND xmlvalue like'%<string>%';

    For MSSQL

    SELECT * FROM genericconfiguration WHERE DATAKEY IN ( SELECT b.id FROM customfield a, fieldconfiguration b where b.FIELDID = ('customfield_' + cast(a.id as varchar)) AND a.CUSTOMFIELDTYPEKEY LIKE '%select%' ) AND xmlvalue LIKE '%<string>%';

  • This will result on the following:

ID

DATATYPE

DATAKEY

XMLVALUE

10080

DefaultValue

10150

<list> <string>Functionality</string></list>

  • Take note of the value in the DATAKEY column of the result set. This is theaffectedcustomfield ID. In our example, this ID is 10150.

  • Run the query below replacing the example ID in the WHERE clause with the customfield ID that you just discovered.

    SELECT * FROM FIELDCONFIGURATION WHERE ID=10150

  • This will result on the following:

ID

CONFIGNAME

DESCRIPTION

FIELDID

CUSTOMFIELD

10150

Default Configuration for Test Group

Default configuration generated by JIRA

customfield_10140

  • Take note of the value in the FIELDID column. In our example, this value is customfield_10140

  • Run the query below replacing the ID in the WHERE clause with the numerical value from the FIELDID you just discovered. (for example, customfield_10140 = 10140)

    SELECT id, cfname FROM CUSTOMFIELD WHERE ID=10140

  • This will result on the following:

ID

CFNAME

10140

Name

  • Take note of the value in the CFNAME column. This is the custom field's name. You will need this to find the field in JIRA's admin section later on.

  • Delete the affected default value by running the following query. There is no need to replace anything in this query.

    DELETE FROM genericconfiguration where DATAKEY IN (SELECT b.id FROM customfield a, fieldconfiguration b where b.FIELDID=INSERT('customfield_',13,5,a.id) AND CUSTOMFIELDTYPEKEY like '%select%');

  • For MSSQL

    DELETE FROM genericconfiguration WHERE DATAKEY IN ( SELECT b.id FROM customfield a, fieldconfiguration b where b.FIELDID = ('customfield_' + cast(a.id as varchar)) AND a.CUSTOMFIELDTYPEKEY LIKE '%select%' ) AND xmlvalue LIKE '%<string>%';

  • Restart JIRA

  • Log into JIRA as an Admin. Navigate to Administration > Customfield, locate the custom field in question (you got the name earlier) and set the default value for the affected custom field manually.

Updated on June 26, 2025

Still need help?

The Atlassian Community is here for you.