Existing attachments will not open after migrating Jira server
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 Migrating/Upgrading JIRA, the previous attachments that are included in the instance can not be opened through the UI, but new attachments are working without any problem.
The following appears in the catalina.out
:
2015-10-05 14:26:52,058 http-bio-8080-exec-1 ERROR jiraadmin 866x99x1 1xmyu65 29.138.1.157 /secure/attachment/22730/Sonderzeichen%20f%C3%BCr%20die%20gesch%C3%A4tzten%20nicht%20%C3%BCbernommen.jpg [jira.web.servlet.ViewAttachmentServlet] Error serving file for path /22730/Auf Reisekostendokument werden die Sonderzeichen für die geschätzten Kosten nicht übernen.jpg: Attachment does not exist in filesystem /opt/atlassian/jira-application-data/data/attachments/TEST/TEST-XXXX/XXXX_Sonderzeichen f�r die gesch�tzten nicht �bernommen.jpg
com.atlassian.jira.issue.attachment.NoAttachmentDataException: Attachment does not exist in filesystem /opt/atlassian/jira-application-data/data/attachments/TEST/TEST-XXXX/XXXX_Sonderzeichen f�r die gesch�tzten nicht �bernommen.jpg
at com.atlassian.jira.issue.attachment.store.DefaultFileSystemAttachmentStore.getAttachmentData(DefaultFileSystemAttachmentStore.java:165)
at com.atlassian.jira.issue.attachment.store.DefaultFileSystemAttachmentStore.getAttachment(DefaultFileSystemAttachmentStore.java:140)
at com.atlassian.jira.issue.attachment.store.BackwardCompatibleStoreAdapter.getAttachment(BackwardCompatibleStoreAdapter.java:115)
at com.atlassian.jira.issue.attachment.BackwardCompatibleAttachmentStore.getAttachment(BackwardCompatibleAttachmentStore.java:189)
at com.atlassian.jira.issue.attachment.BackwardCompatibleAttachmentStore.getAttachment(BackwardCompatibleAttachmentStore.java:244)
at com.atlassian.jira.issue.managers.DefaultAttachmentManager.streamAttachmentContent(DefaultAttachmentManager.java:867)
at com.atlassian.jira.web.servlet.ViewAttachmentServlet.getInputStream(ViewAttachmentServlet.java:44)
at com.atlassian.jira.web.servlet.AbstractViewFileServlet.streamFileData(AbstractViewFileServlet.java:98)
at com.atlassian.jira.web.servlet.AbstractViewFileServlet.doGet(AbstractViewFileServlet.java:60)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
Diagnosis
- Check to see if your operating system, JIRA itself, and the Database are using the recommended encoding/character set
- Check the Attachment names on JIRA, the Database and File system to see if they all match.
To check the attachment on the database, run the query below:
select * from fileattachment;
Cause
The attachment name is different between the database and filename or the characters are not being rendered as expected (an unsupported encoding/character set is being used somewhere).
This can also be caused by symbolic links on the Jira home directory.
Workaround
- If the attachment file name is broken on the OS side, you will need to be rename them one by one.
If the system is a Linux-based OS, you can convert the filename to the right character encoding using the convmv tool.
- Find symbolic links and remove them:
sudo find -type l
Post Fix important step
It's also expected that after moving the attachments after the migration, the thumbnails of the attachments can get broken, and you may run the SQL query below in order to fix this:
- Make a backup of your database
Run the SQL Query:
UPDATE fileattachment set thumbnailable = null where thumbnailable = 0;
- Run a Full Lock Re-index: Go to Administration > System > Under Advanced > Indexing > Full re-index
- Reference: Attachment thumbnails not displaying after Jira server migration