Importing from Cloud to Server fails while restoring Active Objects data
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
Importing XML backup from Cloud to Jira Server fails while restoring Active Object with following SQL exception. The error occurs while adding a foreign key constraint for table AO_56464C_APPROVAL_SOURCE, AO_56464C_APPROVER_LIST
1
There was a problem restoring ActiveObjects data for the <unknown plugin> plugin. Caught exception with following message: ERROR: relation "public.JIRAISSUE" does not exist. Please check the log for details.
Environment
Jira Server/Data Center
Diagnosis
The following appears in atlassian-jira.log:
1
2022-07-23 16:03:30,933 http-nio-8080-exec-15 INFO xxxx xxxxx xxxx /secure/admin/XmlRestore.jspa [c.a.j.w.action.util.ImportAll] Running ImportAll
Restoration Looks good until 90%:
1
2022-07-23 16:04:11,013 JiraImportTaskExecutionThread-1 INFO xxxx xxxxx xxxx /secure/admin/XmlRestore.jspa [c.a.j.bc.dataimport.DefaultDataImportService] Importing data is 90% complete...
Later in the log, the restoration is crashed due to an SQL Exception while restoring the Active Objects "ERROR: relation "public.JIRAISSUE" does not exist"
1
2
3
4
5
2022-07-23 16:04:18,542 JiraImportTaskExecutionThread-1 ERROR xxxx xxxxx xxxx /secure/admin/XmlRestore.jspa [c.a.j.bc.dataimport.DefaultDataImportService] Error during ActiveObjects restore
com.atlassian.activeobjects.spi.ActiveObjectsImportExportException: There was an error during import/export with <unknown plugin>:Error executing update for SQL statement 'ALTER TABLE public."AO_56464C_APPROVAL_SOURCE" ADD CONSTRAINT "fk_ao_56464c_approval_source_issue_id" FOREIGN KEY ("ISSUE_ID") REFERENCES public."JIRAISSUE"("ID")'
at com.atlassian.activeobjects.backup.ImportExportErrorServiceImpl.newImportExportSqlException(ImportExportErrorServiceImpl.java:26)
at com.atlassian.activeobjects.backup.SqlUtils.onSqlException(SqlUtils.java:46)
at com.atlassian.activeobjects.backup.SqlUtils.executeUpdate(SqlUtils.java:37)
1
2
3
Caused by: org.postgresql.util.PSQLException: ERROR: relation "public.AO_E8B6CC_ORGANIZATION_MAPPING" does not exist
Caused by: org.postgresql.util.PSQLException: ERROR: relation "public.AO_21F425_MESSAGE_AO" does not exist
Caused by: org.postgresql.util.PSQLException: ERROR: relation "public.AO_4789DD_HEALTH_CHECK_WATCHER" does not exist
Cause
This issue is caused by the following JSDCLOUD-11543 - Importing from Cloud to Server fails while restoring Active Objects.
Solution
Please follow the below steps for removing the entries that cause the issue and retry the import:
Unzip Jira cloud backup
1 2 3 4
unzip cloudbackup.zip Archive: cloudbackup.zip inflating: entities.xml inflating: activeobjects.xml
Expand xml to multiple lines:
1
xmllint activeobjects.xml --format > activeobjects_fixed.xml
Remove the foreign key entries from activeobjects_fixed.xml
1 2 3
<foreignKey fromTable="AO_56464C_APPROVAL_SOURCE" fromColumn="ISSUE_ID" toTable="JIRAISSUE" toColumn="ID" /> <foreignKey fromTable="AO_56464C_APPROVER_LIST" fromColumn="ISSUE_ID" toTable="JIRAISSUE" toColumn="ID" /> <foreignKey fromTable="AO_60DB71_LEXORANK" fromColumn="FIELD_ID" toTable="LEXORANK_FIELD_ID" toColumn="ID" />
Make another copy of activeobjects.xml in the multiline format:
1
xmllint activeobjects.xml --format > testing.xml
Now we will Diff the fixed file to the original to ensure only 3 lines were removed (output should look like below):
1 2 3 4
diff testing.xml activeobjects_fixed.xml <foreignKey fromTable="AO_56464C_APPROVAL_SOURCE" fromColumn="ISSUE_ID" toTable="JIRAISSUE" toColumn="ID" /> <foreignKey fromTable="AO_56464C_APPROVER_LIST" fromColumn="ISSUE_ID" toTable="JIRAISSUE" toColumn="ID" /> <foreignKey fromTable="AO_60DB71_LEXORANK" fromColumn="FIELD_ID" toTable="LEXORANK_FIELD_ID" toColumn="ID" />
Delete the old active objects file and rename the fixed one to activeobjects.xml
1
mv activeobjects_fixed.xml activeobjects.xml
Zip up the XML backup files again
1
zip -r fixed.zip activeobjects.xml entities.xml
Move the backup to the import directory on the destination instance and perform the import again
Was this helpful?