Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

com.adobe.granite.workflow.WorkflowException: Document is in a disposed state!


Level 2

Hey everyone,


I'm having trouble with my workflow trying to save a document to filesystem. Basically, we have a custom step that help us save documents into filesystem and is working as expected (it saved attachments from an Assign Task to a specific file location). Here you have to set the file location including the name of the file and the document that you want to save:



The problem I'm having is with the Generate Document of Record, I have the following configuration for the step. formData represents the all the data the user submitted from a form and document is just the variable type Document.



This is the error triggered when trying to save a document from the Generate Document of Record:

com.adobe.granite.workflow.WorkflowException: Process execution resulted in an error
at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:201)
at com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:260)
at org.apache.sling.event.impl.jobs.JobConsumerManager$JobConsumerWrapper.process(JobConsumerManager.java:502)
at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.startJob(JobQueueImpl.java:293)
at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.access$100(JobQueueImpl.java:60)
at org.apache.sling.event.impl.jobs.queues.JobQueueImpl$1.run(JobQueueImpl.java:229)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.adobe.granite.workflow.WorkflowException: Document is in a disposed state!
at com.s360g.aem.workflowcomponent.custom.saveDocumentToFilesystem.execute(saveDocumentToFilesystem.java:81)
at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:195)
... 8 more


Let me know if I'm configuring something wrong or if some has seen this error


Best regards,

1 Reply


Level 4

Hi @SebasRios34 ,

Can you please provide saveDocumentToFilesystem this file or else what is the line at 81, just to see what can be the issue.