It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Exception while saving attachment - Unable to create target file

Thor Weinreich Aug 09, 2017

Hi together,

When I try to save an E-Mail attachment I get the following error in my log:

2017-08-09 09:41:54,838 Caesium-1-3 WARN admin LOREM [c.a.j.issue.managers.DefaultAttachmentManager] Got exception while saving attachment in attachment store. Exception: Unable to create target file /var/atlassian/jira/data/attachments/BLUBB/10000/BLUBB-106/10008
2017-08-09 09:41:54,838 Caesium-1-3 DEBUG admin LOREM [c.a.j.issue.managers.DefaultAttachmentManager]
com.atlassian.jira.issue.attachment.AttachmentMoveException: Unable to create target file /var/atlassian/jira/data/attachments/BLUBB/10000/BLUBB-106/10008
at com.atlassian.util.concurrent.Functions$ToGoogleAdapter.apply(
at com.atlassian.util.concurrent.Promises$Of$1.apply(
at com.atlassian.util.concurrent.Promises$2.onSuccess(
at com.atlassian.util.concurrent.Executors$DefaultSubmitter$
at com.atlassian.util.concurrent.LimitedExecutor$
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$


Here some of my specs:

* JIRA Software 7.3.6

* runs as docker container

* file for test is a simple TXT with nothing special

* code runs inside a mail handler plugin

* I have tried to create the attachment in mutliple ways:

context.createAttachment(attachmentFile, attachmentName, attachmentContentType, user, createIssueValidationResult.getIssue());

But I always get this error. The user is allowed to create attachments and I can upload them manually with the GUI.


Does anyone have a clue how to tackle this problem?


Thank you in advance!

1 answer

1 accepted

0 votes
Answer accepted
Thor Weinreich Aug 10, 2017 • edited Aug 14, 2017

Ok just now something strange happend. I changed the construction of my filepath to create the attachment file to this:

String filepath = PathUtils.joinPaths(attachmentPathManager.getDefaultAttachmentPath(), project, currentProject.getId().toString(), issueKey, attachmentName);

The errors I mentioned before were thrown when the last parameter of this statement was the attachment ID.

With this change I faced another error:

2017-08-10 15:58:59,267 Caesium-1-1 WARN admin IPSUM [c.a.j.issue.managers.DefaultAttachmentManager] Got exception while saving attachment in attach
ment store. Exception: /var/atlassian/jira/data/attachments/BLUBB/10000/BLUBB-139/test.pdf (No such file or directory)
2017-08-10 15:58:59,267 Caesium-1-1 DEBUG admin IPSUM [c.a.j.issue.managers.DefaultAttachmentManager] /var/atlassian/jira/data/attachments/BLUBB/10000/BLUBB-139/test.pdf (No such file or directory)
at Method)
at com.atlassian.jira.issue.managers.DefaultAttachmentManager.putAttachmentFileToAttachmentStore(
at com.atlassian.jira.issue.managers.DefaultAttachmentManager.safelyPutAttachmentFileToAttachmentStore(
at com.atlassian.jira.issue.managers.DefaultAttachmentManager.createAttachmentFromFile(
at com.atlassian.jira.issue.managers.DefaultAttachmentManager.createAttachmentImpl(
at com.atlassian.jira.issue.managers.DefaultAttachmentManager.tryCreateAttachment(
at com.atlassian.jira.issue.managers.DefaultAttachmentManager.createAttachment(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(
at com.sun.proxy.$Proxy564.createAttachment(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at com.atlassian.plugin.osgi.bridge.external.HostComponentFactoryBean$DynamicServiceInvocationHandler.invoke(
at com.sun.proxy.$Proxy564.createAttachment(Unknown Source)
at de.test.plugins.jira.custommailhandler.CustomMailHandler.handleMessage(
at com.atlassian.jira.service.ServiceRunner.runService(
at com.atlassian.jira.service.ServiceRunner.runServiceId(
at com.atlassian.jira.service.ServiceRunner.runJob(
at com.atlassian.scheduler.core.JobLauncher.runJob(
at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(
at com.atlassian.scheduler.core.JobLauncher.launch(
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJob(
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJobWithRecoveryGuard(
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(
at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(
at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(
2017-08-10 15:58:59,267 Caesium-1-1 WARN admin IPSUM [c.a.j.issue.managers.DefaultAttachmentManager] Cannot remove source attachment file /var/atlassian/jira/data/attachments/BLUBB/10000/BLUBB-139/test.pdf


But it is getting better:

The file was attached to the issue and I can even download and open it correctly. That is some really strange thing that happens here, can anyone give me some details that I may be missing? 



Set this to 'accepted answer' because I got no response at all and it does everything as expected except throwing these missleading errors.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Jira

Try Jira Cloud for Outlook: Organize your work without leaving your inbox

Hi Atlassian community, My name is Max and I work on the product integration team at Atlassian. I am pleased to announce the early access program for the Jira Cloud add-in for Outlook. This add-in...

1,256 views 2 13
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you