Unable to Preview/open Attachments (PDF or Videos files) in Google Chrome/IE/Firefox

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

Problem

After upgrading to Confluence 5.9.x, attached PDF files/.mp4 videos can't be previewed in Google Chrome and Internet Explorer. The following errors appear in atlassian-confluence.log:

2016-08-03 15:13:18,925 ERROR [http-nio-443-exec-11] [[Standalone].[localhost].[/].[file-server]] log Servlet.service() for servlet [file-server] in context with path [] threw exception java.lang.UnsupportedOperationException: This implementation has been deprecated. Use FileSystemAttachmentDataDao instead.
        at com.atlassian.confluence.pages.persistence.dao.hibernate.HibernateAttachmentDataDao.getDataForAttachment(HibernateAttachmentDataDao.java:362)
        at com.atlassian.confluence.pages.persistence.dao.hibernate.AbstractHibernateAttachmentDao.getAttachmentData(AbstractHibernateAttachmentDao.java:237)
        at com.atlassian.confluence.pages.attachments.CachingAttachmentDao.getAttachmentData(CachingAttachmentDao.java:174)
        at com.atlassian.confluence.pages.DefaultAttachmentManager.getAttachmentData(DefaultAttachmentManager.java:231)
        at com.atlassian.confluence.pages.DelegatorAttachmentManager.getAttachmentData(DelegatorAttachmentManager.java:119)
...

Diagnosis

Environment and Configuration

  • Confluence Version: Confluence 5.9.x and above
  • Confluence configured to store attachments in the database.

Cause

The cause of this issue is storing attachments in the database.

Database attachment storage was deprecated in Confluence 5.5 and is no longer supported; please see Attachment Storage Configuration for more information. In Confluence 5.9, a check was added to enforce storing attachments in the file system. 

Resolution

  • Migrate to the supported file system attachment storage option (instructions from Attachment Storage Configuration)

    1. Check that you're using Confluence 8.1 or newer.
    2. Check that the migration to v4 hierarchical attachment storage structure is complete. Learn how to do this
    3. Create a new Amazon S3 bucket for Confluence (follow step 1 on Configuring S3 object storage).
    4. Migrate the v4 attachment data (${confluenceHome}/attachments/v4) from its physical source to the root prefix confluence/attachments/ in the S3 bucket.
      For example:

      File system${confluenceHome}/attachments/v4/14/0/327689/327689.1
      S3<S3_Bucket>/confluence/attachments/v4/14/0/327689/327689.1

      The physical location of this data is dependent on your environment. For example, clustered environments typically host this data in a network file system (NFS) as a shared mount. You'll need to consider you setup and the amount of attachment data that needs to be migrated. In general, we recommend using Amazon DataSync for migration. Learn how to do this

    5. Wait for the migration to complete.

    6. Configure your Confluence node(s) one by one with AWS authentication details and your S3 configuration (follow steps 2 and 3 on Configuring S3 object storage).

      1. Consider putting Confluence into read-only mode to avoid data creation until all node(s) are configured for S3.
      2. After providing the relevant configuration, each node will require a restart.

      3. During this process, if attachments are created on nodes that have yet to be configured for S3, then the attachment data won't be available to those nodes that have been configured for S3.

    7. Verify that Confluence is using S3 object storage with the following steps:
      1. Go to Administration  > General Configuration > System Information

      2. Next to 'Attachment Storage Type', you'll see 'S3'

      3. Additionally, next to 'Java Runtime Arguments', both the bucket name and region system properties and their respective values will be visible.

    8. Re-run the original DataSync job to perform a final sync. This should be done after all the nodes have been configured to ensure all attachment data is migrated.

    (tick) At this stage, attachment data will be read and written from AWS S3.

    DataSync does not alter or remove the source file system data. So, if you no longer need the attachment data stored on the file system, you'll need to clean this up manually.

    Troubleshooting

    As the source file system data is not altered or removed by DataSync, Confluence can be reverted back to reading and writing attachment data from the file system. To do this, remove the configuration below from your setenv.sh and/or confluence.cfg.xml, and restart Confluence:

    • confluence.filestore.attachments.s3.bucket.name

    • confluence.filestore.attachments.s3.bucket.region

    If you are reverting back to the original file system, any data written to S3 will need to be synced back to the file system manually by the Confluence administrator.

    When the migration occurs, all other users will be locked out of the Confluence instance. This is to prevent modification of attachments while the migration occurs. Access will be restored as soon as the migration is complete.

 

Last modified on Nov 10, 2017

Was this helpful?

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