Confluence 3.x upgrade fails due to failed attachment migration

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

Upgrading to Confluence 3.0.x fails with the following exception:

FATAL [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized Upgrade failed, application will not start: java.lang.RuntimeException: The attachment
 migration could not be completed since files already exist in the attachments directory blocking those that need to be created.
...
Caused by: java.lang.RuntimeException: The attachment migration could not be completed since files already exist in the attachments directory blocking those that need to be created.

Cause

The attachments directory contains files or directories which the upgrade task wants to create. That is, a top level directory called 'ver003' containing directories or files with names containing up to 3 digits (e.g. 1, 213).

Typical scenario is the upgrade failed, then was rolled back to whatever version you were using (this however does not remove the "ver003" folder if it has been created in the previous upgrade attempt). When upgrading to Confluence 3.x again, Confluence discovers that the new attachment file structure has already exist and throw the exception. Refer to Hierarchical File System Attachments Storage for technical information.

Resolution

To resolve this problem,

  1. Shut down Confluence.
  2. Make a backup of your existing Confluence Home directory, just in case.
  3. Restore your old copy of the Confluence Home directory.
  4. Make sure that 'ver003' folder does not exist in Confluence home directory (<confluence-home>/attachments/ver003).
  5. Make sure that the (<confluence home folder>/attachments/ folder contains the old attachments directory structure. Eg. <confluence home>/attachments/<pageid>/<attachment id>/1

    tip/resting Created with Sketch.

    If they do not exist then your instance will not have any attachments.

  6. Restart Confluence 3.0.x and check the atlassian-confluence.log file for any error.
tip/resting Created with Sketch.

To run the attachment migration process manually, log in to Confluence as an admin and point your browser to the URL http://<baseURL>/admin/restructureattachments.jsp.

Last modified on Nov 14, 2018

Was this helpful?

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