Migrating Confluence attachments storage from database to file system fails with InputStream cannot be null.

Still need help?

The Atlassian Community is here for you.

Ask the community


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

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:

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.

  1. Shutdown Confluence

  2. Backup the database
  3. Run this SQL command to identify the NULL rows

    select attachmentdataid from attachmentdata where data is NULL;


  4. Run the command below to remove the NULL rows

    delete from attachmentdata where data is NULL;
  5. Restart Confluence
  6. Attempt a new migration process.



Last modified on Nov 26, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.