Unable to Preview/open Attachments (PDF or Videos files) in Google Chrome/IE/Firefox
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)
- Go to Administration > General Configuration > Attachment storage.
- Click Edit to modify the configuration.
- Select Locally in Confluence home directory.
- Click Save to save the changes.
- A screen will appear, asking you to confirm your changes. Selecting 'Migrate' will take you to a screen that displays the progress of the migration.
Screenshot: migration warning
If you're already storing attachments in a file system, the Attachment Storage option won't appear in the admin console - this is because you're already using the only supported storage method, and don't need to migrate.
Troubleshooting
It is a known issue that the checkbox may appear disabled. If you can't select the checkbox next to Locally in Confluence home directory (step 3 above), see Unable to select form to migrate attachments from Confluence database to file system for a workaround.
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.