Jira project import failed with unexpected problem processing the backup XML file
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
Project import validation failed with NullPointerException referencing CustomFieldValue.xml:
atlassian-jira.log
1
2
3
4
5
2021-06-07 13:07:55,949+0000 JiraTaskExecutionThread-6 ERROR Test 787x492x1 7zbvjj 172.29.186.150 /secure/admin/ProjectImportSelectProject.jspa [c.a.j.imports.project.DefaultProjectImportService] There was an unexpected problem processing the file '/xxx/xxx/CustomFieldValue.xml' when performing a project import.
java.lang.NullPointerException
at com.atlassian.jira.imports.project.customfield.TextLengthValidatingCustomFieldImporter.canMapImportValue(TextLengthValidatingCustomFieldImporter.java:24)
at com.atlassian.jira.imports.project.handler.CustomFieldValueValidatorHandler.validateCustomFieldValueWithField(CustomFieldValueValidatorHandler.java:98)
at com.atlassian.jira.imports.project.handler.CustomFieldValueValidatorHandler.handleEntity(CustomFieldValueValidatorHandler.java:73)

Environment
Jira 7.x, Jira 8.x, Jira 9.x, Jira 10.x
Diagnosis
Reviewing the stacktrace associated to the NullPointerException, the exception is returned as it's validating the custom field value length.
Cause
The NullPointerException is due to the missing stringvalue/textvalue/numbervalue/datevalue associated to the custom field entries defined in the entities.xml file. Since the cause is unexpected, there was a bug ticket raised to address this: JRASERVER-78031 - Project import validation fails with NullPointerException referencing CustomFieldValue.xml.
Solution
Please follow the below steps to rectify the missing value entries:
Uncompressed the XML backup file used for the project import
Run the following command against the entities.xml to identify the problematic entries:
1
grep "<CustomFieldValue" entities.xml | grep -v stringvalue |grep -v numbervalue| grep -v textvalue | grep -v datevalue | grep "/>"
To fix up the missing value, we can either update the custom field from the source Jira instance OR update the problematic entries in existing XML backup.
For example, following is the problematic entry returned from the step 2:
1
<CustomFieldValue id="10000" issue="10111" customfield="10222"/>
Update the custom field in the Jira issue from the source Jira instance:
Identify the custom field by running the following SQL query against the source Jira database:
1
SELECT cfname FROM customfield WHERE customfield="10222";
Identify the Jira issue that has the custom field with missing value by running the following SQL query against the source Jira database:
1 2 3
select p.pname, p.pkey, ji.issuenum from jiraissue ji join project p on ji.project=p.id where ji.id=10111;
From the source Jira application, go to the Jira issue identified above and update the identified custom field with a valid value.
ℹ️ If there are more than one problematic entry returned from step 2, please run through the same steps to update all the relevant Jira issues with the custom field before proceed to the next step.
Generate the XML backup once the update is done and attempt the project import again.
Update the problematic entries in existing XML backup:
Uncompress the XML backup zip file
Update all the problematic entries with empty string/valid value for the custom field in entities.xml file:
1
<CustomFieldValue id="10000" issue="10111" customfield="10222" stringvalue=""/>
Compress the updated entities.xml and activeobjects.xml into a zip file and attempt the project import again.
Was this helpful?