"We couldn't export Issue Reason: java.lang.NullPointerException" error message in JCMA
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
The following article offers guidance on resolving the JCMA 000 java.lang.NullPointerException error messages during the project export.
Overview
When migrating projects from the Jira On-Premise instance to the Cloud using the Jira Cloud Migration Assistant (JCMA), specific issues fail to migrate with the below error message:
ERROR <project-key> project-export We couldn't export Issue <issue-key>. Reason: java.lang.NullPointerException.
And in the application logs we can see the following error:
ERROR /rest/migration/latest/check/<check-id> [c.a.j.m.export.framework.DefaultExportFailureHandler] <check-id>: Exporting entity Issue <issue-key> failed
Cause
There are many reasons why a NullPointerExeption is raised, usually meaning that an entity within the exported data is either null or invalid.
We can use the error message call stack to better determine the entity that provoked the error.
/rest/migration/latest/check/<check-id> [c.a.j.m.export.framework.DefaultExportFailureHandler] <check-id>: Exporting entity Issue ABC-123 failed
java.lang.NullPointerException
at com.atlassian.jira.migration.export.core.issue.IssueExporter.hasValidIssueStatusInWorkflow(IssueExporter.kt:571)
at com.atlassian.jira.migration.export.core.issue.IssueExporter.access$hasValidIssueStatusInWorkflow(IssueExporter.kt:84)
The above error shows that the NullPointerException was raised in the method hasValidIssueStatusInWorkflow().
This indicates that the invalid or null entry is likely an Issue Status referenced in the issue ABC-123.
How to identify the affected entity
Below are some pointers on how to identify the affected entity based on the error call stack.
More scenarios will be updated in this document as we see them.
Identify sub-tasks without the Parent issue
This can be identified using the following database query:
PostgreSQL
WITH issuelist AS (
SELECT il.source AS sourceid
, COALESCE(CONCAT(ps.PKEY, '-', js.ISSUENUM), 'non-existent') AS source
, il.destination AS destinationid
, COALESCE(CONCAT(pd.PKEY, '-', jd.ISSUENUM), 'non-existent') AS destination
, ilt.linkname AS linkname
, il.id AS issuelinkid
FROM issuelink il
LEFT JOIN jiraissue js ON (js.id = il.source)
LEFT JOIN project ps ON (ps.id = js.project)
LEFT JOIN jiraissue jd ON (jd.id = il.destination)
LEFT JOIN project pd ON (pd.id = jd.project)
LEFT JOIN issuelinktype ilt ON (ilt.id = il.linktype)
)
SELECT *
FROM issuelist
WHERE sourceid IS NULL
OR destinationid IS NULL;
Oracle
WITH issuelist AS (
SELECT il.SOURCE AS sourceid
, CONCAT(CONCAT(COALESCE(ps.PKEY,'non'), '-'), COALESCE(TO_CHAR(js.ISSUENUM), 'existent')) AS source
, il.DESTINATION AS destinationid
, CONCAT(CONCAT(COALESCE(pd.PKEY,'non'), '-'), COALESCE(TO_CHAR(jd.ISSUENUM), 'existent')) AS destination
, ilt.LINKNAME AS linkname
, il.ID AS issuelinkid
FROM ISSUELINK il
LEFT JOIN JIRAISSUE js ON (js.ID = il.SOURCE)
LEFT JOIN PROJECT ps ON (ps.ID = js.PROJECT)
LEFT JOIN JIRAISSUE jd ON (jd.ID = il.DESTINATION)
LEFT JOIN PROJECT pd ON (pd.ID = jd.PROJECT)
LEFT JOIN ISSUELINKTYPE ilt ON (ilt.ID = il.LINKTYPE)
)
SELECT *
FROM issuelist
WHERE sourceid IS NULL
OR destinationid IS NULL;
MySQL
SELECT il.SOURCE AS sourceid
, COALESCE(CONCAT(ps.PKEY, '-', js.ISSUENUM), 'non-existent') AS source
, il.DESTINATION AS destinationid
, COALESCE(CONCAT(pd.PKEY, '-', jd.ISSUENUM), 'non-existent') AS destination
, ilt.LINKNAME AS linkname
, il.ID AS issuelinkid
FROM ISSUELINK il
LEFT JOIN JIRAISSUE js ON (js.ID = il.SOURCE)
LEFT JOIN PROJECT ps ON (ps.ID = js.PROJECT)
LEFT JOIN JIRAISSUE jd ON (jd.ID = il.DESTINATION)
LEFT JOIN PROJECT pd ON (pd.ID = jd.PROJECT)
LEFT JOIN ISSUELINKTYPE ilt ON (ilt.ID = il.LINKTYPE)
WHERE (il.SOURCE NOT IN (SELECT ID FROM JIRAISSUE) OR il.DESTINATION NOT IN (SELECT ID FROM JIRAISSUE));
MSSQL
WITH issuelist AS (
SELECT il.SOURCE AS sourceid
, CONCAT(CONCAT(COALESCE(ps.PKEY,'non'), '-'), COALESCE(js.ISSUENUM, 'existent')) AS source
, il.DESTINATION AS destinationid
, CONCAT(CONCAT(COALESCE(pd.PKEY,'non'), '-'), COALESCE(jd.ISSUENUM, 'existent')) AS destination
, ilt.LINKNAME AS linkname
, il.ID AS issuelinkid
FROM ISSUELINK il
LEFT JOIN JIRAISSUE js ON (js.ID = il.SOURCE)
LEFT JOIN PROJECT ps ON (ps.ID = js.PROJECT)
LEFT JOIN JIRAISSUE jd ON (jd.ID = il.DESTINATION)
LEFT JOIN PROJECT pd ON (pd.ID = jd.PROJECT)
LEFT JOIN ISSUELINKTYPE ilt ON (ilt.ID = il.LINKTYPE)
)
SELECT *
FROM issuelist
WHERE sourceid IS NULL
OR destinationid IS NULL;
Identify invalid Issue Statuses
Use the following SQL query to identify the missing/null issue status:
SELECT * FROM jiraissue WHERE issuestatus IS NULL;
Solution
A few workarounds are available:
- Modify the specific issue by assigning a valid value to the individual issues identified, like:
- Assign a parent issue to the child issue.
- Assign a valid issue status to the issue.
- Delete the issue that doesn't have a parent