Space import fails with "No enum constant com.atlassian.confluence.spaces.SpaceStatus"
Symptoms
When importing a space XML backup into Confluence, the import fails with an error on screen like so:
The following appears in the atlassian-confluence.log
:
2014-05-29 11:17:34,695 ERROR [Long running task: Importing data] [confluence.importexport.xmlimport.BackupImporter] importEntities Cannot import the entities:
-- url: /admin/restore.action | userName: admin | referer: http://confluence.example.com:8090/admin/backup.action | action: restore
com.atlassian.confluence.importexport.ImportExportException: Unable to complete import: Error while importing backup: No enum constant com.atlassian.confluence.spaces.SpaceStatus.
at com.atlassian.confluence.importexport.xmlimport.DefaultXmlImporter.doImport(DefaultXmlImporter.java:76)
at com.atlassian.confluence.importexport.xmlimport.BackupImporter.importEntities(BackupImporter.java:404)
at com.atlassian.confluence.importexport.xmlimport.BackupImporter.importEverything(BackupImporter.java:372)
at com.atlassian.confluence.importexport.xmlimport.FileBackupImporter.importEverything(FileBackupImporter.java:138)
at com.atlassian.confluence.importexport.xmlimport.BackupImporter$1.doInTransactionWithoutResult(BackupImporter.java:210)
...
Cause
SpaceStatus
is a property in the backup file that requires one of two values, "CURRENT" or "ARCHIVED". The error is thrown if neither exist.
Workaround
- Unzip your XML .zip backup file
- Locate and edit entities.xml
Find the following property:
<property name="spaceStatus" enum-class="SpaceStatus" package="com.atlassian.confluence.spaces"/>
Replace it with the following:
<property name="spaceStatus" enum-class="SpaceStatus" package="com.atlassian.confluence.spaces">CURRENT</property>
If you want the space to be marked as Archived, used "ARCHIVED" instead of "CURRENT" for the property value.
Zip up all the files again.
Important: Ensure that the files you're zipping up are at the root of the archive, and not nested under a subdirectory. In other words, do not put all the backup files under a directory and simply zip up the directory. Doing this will cause the the restore to fail when you attempt to import the space into Confluence.