Migrating Confluence attachments storage from database to file system fails with InputStream cannot be null.
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
Attempting to export the attachments from the database to the file system fails.
Environment
Confluence server and Datacenter
Diagnosis
Confluence server had an option to store the attachment files in the database. In Confluence 5.5 it was deprecated and we provide an option to migrate the attachments from the database to the file system. This KB treats an issue with the migration process and is only applicable in this scenario.
The following error appears in the atlassian-confluence.log when attempting to migrate the attachments from the database to the file system:
1
2
3
ERROR [Long running task: Attachment data migration] [confluence.util.longrunning.AttachmentMigrationLongRunningTask] runInternal inputStream cannot be null
-- url: /wiki/admin/doattachmentmigration.action | referer: Confluence_base_URL/admin/doeditattachmentstorage.action | traceId: ada3fdd04c8e8490 | userName: admin| action: doattachmentmigration
java.lang.NullPointerException: inputStream cannot be null
Cause
There are missing attachments in the attachmentdata table on the database. The migration process fails when it attempts to read the missing data.
Solution
Remove the missing rows using the steps below.
Always perform a full database backup before running any SQL commands.
Shutdown Confluence
Backup the database
Run this SQL command to identify the NULL rows
1
select attachmentdataid from attachmentdata where data is NULL;
Run the command below to remove the NULL rows
1
delete from attachmentdata where data is NULL;
Restart Confluence
Attempt a new migration process.
Was this helpful?