Problems to preview attachments in Confluence, Error rendering macro 'view-file'
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
Attachments aren't displayed on the page and preview isn't working. Using the View File macro may error out with: Error rendering macro 'view-file'
com.atlassian.confluence.pages.AttachmentDataNotFoundException: Problem
while getting attachment stream from file system
Environment
This problem was identified in Confluence server and datacenter version 7.11.0, but due to its nature, it can affect most versions of Confluence.
Diagnosis
Attachments can't be previewed and aren't displayed on pages. It's possible to find more about the problem by analyzing the file atlassian-confluence.log
and looking for the following errors:
1
com.atlassian.confluence.pages.AttachmentDataNotFoundException: Problem while getting attachment stream
1
2
ERROR [http-nio-8090-exec-16] [[Standalone].[localhost].[/].[noop]] log Servlet.service() for servlet [noop] in context with path [] threw exception
java.io.FileNotFoundException: /data/confluence/sharedhome/dcl-thumbnail/11/11/44536111/118956102_8 (Permission denied)
1
WARN [http-nio-8090-exec-4] [atlassian.confluence.pages.DefaultAttachmentManager] getAttachmentData Could not find data for attachment: Attachment: filename test - java.io.FileNotFoundException: /data/confluence/sharedhome/attachments/ver003/111/111/45383611/11/11/44536111/118956111/1 (Permission denied)
Cause
The root cause reported in this KB is related to Permission denied to the folder where the attachments reside as seen in the aforementioned errors. By not having the correct permissions, Confluence won't be able to retrieve the attachment from the file system to be displayed in its UI.
It's also possible that the attachments are actually missing from the file system. In this case, refer to How to resolve missing attachments in Confluence.
Solution
File system permissions depend on the operational system, we recommend following How to set file system permissions for Confluence to resolve this problem.
Was this helpful?