You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
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.jira.issue.attachment.store.DefaultFileSystemAttachmentStore.renameOrCopyAndDeleteFile(DefaultFileSystemAttachmentStore.java:295)
at com.atlassian.jira.issue.attachment.store.DefaultFileSystemAttachmentStore.moveFile(DefaultFileSystemAttachmentStore.java:263)
at com.atlassian.jira.issue.attachment.store.DefaultFileSystemAttachmentStore.moveTemporaryToAttachment(DefaultFileSystemAttachmentStore.java:253)
at com.atlassian.jira.issue.attachment.store.DefaultFileSystemAttachmentStore$1.get(DefaultFileSystemAttachmentStore.java:108)
at com.atlassian.jira.issue.attachment.store.DefaultFileSystemAttachmentStore$1.get(DefaultFileSystemAttachmentStore.java:105)
at com.atlassian.util.concurrent.Functions$ToGoogleAdapter.apply(Functions.java:131)
at com.atlassian.util.concurrent.Promises$Of$1.apply(Promises.java:263)
at com.atlassian.util.concurrent.Promises$2.onSuccess(Promises.java:185)
at com.google.common.util.concurrent.Futures$6.run(Futures.java:1319)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:457)
at com.google.common.util.concurrent.ExecutionList.executeListener(ExecutionList.java:156)
at com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:145)
at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:185)
at com.google.common.util.concurrent.SettableFuture.set(SettableFuture.java:53)
at com.atlassian.util.concurrent.Executors$DefaultSubmitter$CallableRunner.run(Executors.java:62)
at com.atlassian.util.concurrent.LimitedExecutor$Runner.run(LimitedExecutor.java:93)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
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:
attachmentManager.createAttachment(attachmentParamsBean);
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!
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]
java.io.FileNotFoundException: /var/atlassian/jira/data/attachments/BLUBB/10000/BLUBB-139/test.pdf (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at com.atlassian.jira.issue.managers.DefaultAttachmentManager.putAttachmentFileToAttachmentStore(DefaultAttachmentManager.java:630)
at com.atlassian.jira.issue.managers.DefaultAttachmentManager.safelyPutAttachmentFileToAttachmentStore(DefaultAttachmentManager.java:649)
at com.atlassian.jira.issue.managers.DefaultAttachmentManager.createAttachmentFromFile(DefaultAttachmentManager.java:515)
at com.atlassian.jira.issue.managers.DefaultAttachmentManager.createAttachmentImpl(DefaultAttachmentManager.java:483)
at com.atlassian.jira.issue.managers.DefaultAttachmentManager.tryCreateAttachment(DefaultAttachmentManager.java:610)
at com.atlassian.jira.issue.managers.DefaultAttachmentManager.createAttachment(DefaultAttachmentManager.java:605)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
at com.sun.proxy.$Proxy564.createAttachment(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.atlassian.plugin.osgi.bridge.external.HostComponentFactoryBean$DynamicServiceInvocationHandler.invoke(HostComponentFactoryBean.java:136)
at com.sun.proxy.$Proxy564.createAttachment(Unknown Source)
at de.test.plugins.jira.custommailhandler.CustomMailHandler.handleMessage(CustomMailHandler.java:404)
at com.atlassian.jira.service.services.mail.MailFetcherService$1.process(MailFetcherService.java:376)
at com.atlassian.jira.service.services.mail.MailFetcherService$MessageProviderImpl.getAndProcessMail(MailFetcherService.java:255)
at com.atlassian.jira.service.services.mail.MailFetcherService.runImpl(MailFetcherService.java:366)
at com.atlassian.jira.service.services.file.AbstractMessageHandlingService.run(AbstractMessageHandlingService.java:229)
at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:61)
at com.atlassian.jira.service.ServiceRunner.runService(ServiceRunner.java:62)
at com.atlassian.jira.service.ServiceRunner.runServiceId(ServiceRunner.java:44)
at com.atlassian.jira.service.ServiceRunner.runJob(ServiceRunner.java:32)
at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:153)
at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:118)
at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:97)
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:443)
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJob(CaesiumSchedulerService.java:438)
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJobWithRecoveryGuard(CaesiumSchedulerService.java:462)
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:390)
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:285)
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:282)
at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:65)
at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:59)
at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:34)
at java.lang.Thread.run(Thread.java:745)
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?
Edit:
Set this to 'accepted answer' because I got no response at all and it does everything as expected except throwing these missleading errors.
Hi I am also trying to add default attachment when an issue create. But it is showing error (No such file or directory)
Can you please help me with this.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.attachment.CreateAttachmentParamsBean
def attachmentManager = ComponentAccessor.getAttachmentManager()
def user = ComponentAccessor.getJiraAuthenticationContext()?.loggedInUser
String pathToFile = "/var/atlassian/application-data/jira/"
String fileName = "ISMS_Awareness.ppt"
String pathAndFile = pathToFile+fileName
def bean = new CreateAttachmentParamsBean.Builder()
.file(new File(pathAndFile))
.filename(fileName)
.contentType("application/x-mspowerpoint")
.author(user)
.issue(issue)
.copySourceFile(true)//you must do this otherwise it deletes the source file from the file system
.build()
attachmentManager.createAttachment(bean)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is it behaving like it did in my case (showing error but creating the file) or do you experience a different issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.