Unable to Create Issue due to corrupt Custom Field
Symptoms
When trying to create an issue, the following is displayed:
Oops - an error has occurred
System Error
A system error has occurred.
Please try submitting this problem via the Support Request Page
Otherwise, please create a support issue on our support system at http://support.atlassian.com with the following information:
- a description of your problem
- cut & paste the error and system information found below
- attach the application server log file ( C:\Atlassian\ApplicationData\home\log\atlassian-jira.log )
Cause:
java.lang.ClassCastException: 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.SelectCFType.getDefaultValue(SelectCFType.java:243)
at com.atlassian.jira.issue.customfields.impl.SelectCFType.getDefaultValue(SelectCFType.java:68)
at com.atlassian.jira.issue.fields.CustomFieldImpl.populateDefaults(CustomFieldImpl.java:561)
And when trying to edit the custom field options, the following System Error appears:
Cause:
com.atlassian.jira.exception.DataAccessException: No custom field for issuetype. This should not happen. Data is likely to be corrupt.
com.atlassian.jira.exception.DataAccessException: No custom field for issuetype. This should not happen. Data is likely to be corrupt.
at com.atlassian.jira.issue.fields.config.FieldConfigImpl.getCustomField(FieldConfigImpl.java:65)
at com.atlassian.jira.web.action.admin.customfields.AbstractEditConfigurationItemAction.getCustomField(AbstractEditConfigurationItemAction.java:37)
Similar symptoms can be seen on the Service Management portal where a form to create an issue will not be displayed when the customer clicks on it.
Cause
The Field Configuration of the custom field is mistakenly pointing to the Field Configuration of the Issue Type instead of it's own. What causes this is yet unknown. However it might be possible the issue was caused by this - JRASERVER-75919Getting issue details... STATUS BUG.
Resolution
Remember to backup your database before making any changes
Get the ID of the problematic Custom Field:
SELECT * FROM customfield WHERE cfname = 'Name';
Replace 'Name' with the actual name of the custom field.
Identify what is the correct id of the Custom Field's Field Configuration:
SELECT * FROM fieldconfiguration WHERE fieldid = 'customfield_XXXXX';
Replace 'XXXXX' with the ID of the custom field returned in the first step.
Identify what is the correct id of the Custom Field's Field Configuration Scheme:
SELECT * FROM fieldconfigscheme WHERE fieldid = 'customfield_XXXXX';
Replace 'XXXXX' with the ID of the custom field returned in the first step.
Ensure there is only one row returned with the following query:
SELECT * FROM fieldconfigschemeissuetype WHERE fieldconfigscheme = <id>;
This is the id returned on step #3 (Field Configuration Scheme id).
Update the database so that the Custom Field will point to the right Field Configuration:
UPDATE fieldconfigschemeissuetype SET fieldconfiguration = <FIELD_CONFIG_ID> WHERE fieldconfigscheme = <FIELD-CONFIG-SCHEME-ID>;
Replace the <FIELD_CONFIG_ID> with the ID returned on step #2 and <FIELD-CONFIG-SCHEME-ID> with the one returned on step #3.