Null pointer exception during Confluence space backup

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

When attempting to create an XML backup for spaces, the process fails and returns an error: (null pointer exception). The following snippet can be located in the atlassian-confluence.log:

2025-05-06 18:23:40,858 WARN [ConfluenceBackupRestoreManager:thread-1] [confluence.impl.backuprestore.ConfluenceBackupRestoreManager] updateJobStateAfterCompletion Backup restore job BackupRestoreJob{id=4442750977, jobOperation=BACKUP, jobScope=SPACE, jobState=PROCESSING, createTime=2025-05-06T18:21:29Z, startProcessingTime=2025-05-06T18:21:29Z, finishProcessingTime=null, cancelTime=null, owner='test', whoCancelledTheJob='null', errorMessage='null'} failed: java.util.concurrent.ExecutionException: java.lang.NullPointerException -- url: /rest/api/backup-restore/backup/space | userName: test | referer: https://test.com/plugins/servlet/space-tool-backup/Test | traceId: 2e49a65b20a4284e com.atlassian.confluence.backuprestore.exception.BackupRestoreException: java.util.concurrent.ExecutionException: java.lang.NullPointerException at com.atlassian.confluence.impl.backuprestore.backup.SpaceBackupService.doBackupSynchronously(SpaceBackupService.java:124) at com.atlassian.confluence.impl.backuprestore.BackupRestoreJobRunner.runJobSynchronously(BackupRestoreJobRunner.java:58) at com.atlassian.confluence.impl.backuprestore.ConfluenceBackupRestoreManager.runJobAndUpdateJobProperties(ConfluenceBackupRestoreManager.java:271) at com.atlassian.confluence.impl.backuprestore.ConfluenceBackupRestoreManager.processJobsFromTheQueue(ConfluenceBackupRestoreManager.java:250) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) at com.atlassian.confluence.impl.backuprestore.ParallelTasksExecutor.waitUntilAllTasksComplete(ParallelTasksExecutor.java:119) at com.atlassian.confluence.impl.backuprestore.ParallelTasksExecutor.waitUntilAllStageJobsComplete(ParallelTasksExecutor.java:92) at com.atlassian.confluence.impl.backuprestore.ParallelTasksExecutor.waitUntilAllStageJobsComplete(ParallelTasksExecutor.java:108) at com.atlassian.confluence.impl.backuprestore.backup.SpaceBackupService.backupAllEntitiesAndAttachments(SpaceBackupService.java:167) at com.atlassian.confluence.impl.backuprestore.backup.AbstractBackupService.performBackup(AbstractBackupService.java:75) at com.atlassian.confluence.impl.backuprestore.backup.SpaceBackupService.doBackupSynchronously(SpaceBackupService.java:107) ... 8 more Caused by: java.lang.NullPointerException at com.atlassian.confluence.impl.backuprestore.backup.exporters.converters.enrichment.UserEmailEnrichment.addUserEmailToEntityObjects(UserEmailEnrichment.java:93) at com.atlassian.confluence.impl.backuprestore.backup.exporters.converters.enrichment.UserEmailEnrichment.enrichElements(UserEmailEnrichment.java:51) at com.atlassian.confluence.impl.backuprestore.backup.exporters.converters.EntityWithAdditionalDataConverter.lambda$convertToObjectsReadyForSerialisation$0(EntityWithAdditionalDataConverter.java:28) at java.base/java.util.Collections$SingletonList.forEach(Collections.java:4856) at com.atlassian.confluence.impl.backuprestore.backup.exporters.converters.EntityWithAdditionalDataConverter.convertToObjectsReadyForSerialisation(EntityWithAdditionalDataConverter.java:28) at com.atlassian.confluence.impl.backuprestore.backup.exporters.CommonDatabaseDataExporter.lambda$getEntityObjectReadyForExportByIds$4(CommonDatabaseDataExporter.java:95) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140) at com.atlassian.confluence.impl.backuprestore.backup.exporters.DatabaseExporterHelper.doInReadOnlyTransaction(DatabaseExporterHelper.java:170) at com.atlassian.confluence.impl.backuprestore.backup.exporters.CommonDatabaseDataExporter.getEntityObjectReadyForExportByIds(CommonDatabaseDataExporter.java:93) at com.atlassian.confluence.impl.backuprestore.backup.exporters.CommonDatabaseDataExporter.lambda$exportUniqueInBatchByQueryWithInCondition$3(CommonDatabaseDataExporter.java:86) ... 4 more

Environment

Confluence Data Center 8.3 or later

Solution

Remove inactive user directories before backup

Any user directory entries that were previously active but are now marked as inactive in your environment will cause this error.

Confluence attempts to verify the email addresses from these inactive external directories, leading to a failure in the specific function (addUserEmailToEntityObjects) which causes the NullPointerException.

Please follow these steps to remove inactive directories before attempting to create an XML backup for spaces:

  1. Take screenshot of inactive directory configuration in your environment

  2. Navigate to Settings > General Configuration > User Directories

  3. Remove all inactive directories

Once done, attempt to create an XML backup for spaces:

  1. Navigate to Settings > General Configuration > Backup and Restore

  2. Backup Site or Spaces

Updated on June 17, 2025

Still need help?

The Atlassian Community is here for you.