Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Adding elements of type document to a list

Avatar

Level 8
Level 8
Hi all,<br /><br />I have encountered an interesting snag:<br /><br />I have a list with subtype document into which I add some documents during my process. <br />In the end of the process I pass the list to a process that takes care of assembling all these documents into one pdf-package (see an earlier post).<br /><br />However if the original process only add one document to the list (depending on the routes taken) I get an coersion error like this one:<br /><br />Internal error.: ALC-DSC-000-000: com.adobe.idp.dsc.DSCRuntimeException: Internal error.<br /> at com.adobe.idp.workflow.dsc.invoker.WorkflowDSCInvoker.transientInvoke(WorkflowDSCInvoker.java:367)<br /> at com.adobe.idp.workflow.dsc.invoker.WorkflowDSCInvoker.invoke(WorkflowDSCInvoker.java:157)<br /> at com.adobe.idp.dsc.interceptor.impl.InvocationInterceptor.intercept(InvocationInterceptor.java:140)<br /><br />...<br /><br />Caused by: ALC-DSC-119-000: com.adobe.idp.dsc.util.InvalidCoercionException: Cannot coerce object: <document state="passive" senderVersion="3" persistent="false" senderPersistent="false" passivated="false" senderPassivated="false" deserialized="true" senderHostId="127.0.0.1/172.16.10.125" callbackId="0" senderCallbackId="0" callbackRef="null" isLocalizable="true" isTransactionBound="false" defaultDisposalTimeout="6000000" disposalTimeout="6000000" maxInlineSize="65536" defaultMaxInlineSize="65536" inlineSize="0" contentType="application/pdf" length="201512"><cacheId/><localBackendId/><globalBackendId/><senderLocalBackendId/><senderGlobalBackendId><DocumentFileID fileName="C:\LiveCycle_Data\GDS\docm1224852936986\8055e8e4802fc4585b1cd038c915c153"/><senderGlobalBackendId/><inline/><senderPullServantJndiName>adobe/idp/DocumentPullServant/adobejb_server1</senderPullServantJndiName><attributes ADOBE_SHAREDPDFDOCUMENT_NEEDS_COPY="true" wsfilename="C:\Documents and Settings\kc.DAFOLO\Skrivebord\Angelina.pdf" basename="Angelina.pdf" file="C:\Documents and Settings\kc.DAFOLO\Skrivebord\Angelina.pdf" ADOBE_SAVE_MODE_ATTRIBUTE="NO_CHANGE" ADOBE_SAVE_MODE_FORCE_COMPRESSED_OBJECTS_ATTRIBUTE="false" ADOBE_SAVE_MODE_REQUIRED_ATTRIBUTE="false"/></document> of type: com.adobe.idp.Document to type: interface java.util.List<br /> at com.adobe.workflow.engine.PEUtil.invokeAction(PEUtil.java:837)<br /> at com.adobe.idp.workflow.dsc.invoker.WorkflowDSCInvoker.transientInvoke(WorkflowDSCInvoker.java:346)<br /><br />Anyone with any good ideas?<br /><br />Thanks in advance<br /><br />Sincerely<br />Kim
8 Replies

Avatar

Level 8
Level 8
Hi again,



Nobody who knows anything on this issue?



To be honest I am puzzled by this myself and I can't see what I can do to fix it. I get the error everytime I have only one element in my list.



Sincerely

Kim

Avatar

Level 10
If you are asking assembler to add all items in a list into a single PDF then only passing one document to Assemble is causing the error. There must be at least 2 docs to do the assembly. The coercion error is coming from the internals of Assembler when trying to read a second doc in your list. You shoudl test the length of the list and if < 2 then bypass the assembly step.

Avatar

Level 8
Level 8
Hi again Paul,<br /><br />Thanks for answering my post.<br /><br />Your explanation sounds reasonable. I will try your suggestion. However in the documentation it states the following under "Assembling multiple documents":<br /><br /> <?xml version="1.0" encoding="UTF-8"?><br /><br /> <DDX xmlns="http://ns.adobe.com/DDX/1.0/"><br /><br /> <PDF result="GeneratedDocument.pdf"><br /><br /> <PDF source="cover"/><br /><br /> <PackageFiles><br /><br /> <PDF source="attachments"/><br /><br /> </PackageFiles><br /><br /> </PDF><br /><br /> </DDX><br /><br />The DDX document provides the following information about the documents to assemble:<br /><br /> * The <PDF source="cover"/> element defines the cover key word, which is associated with the PDF document to use as the cover page.<br /> * The <PDF source="attachments"/> element defines the attachments key word, which is associated with several PDF documents to assemble.<br /><br />The map value must use cover and attachments as keys. The values for the keys must be list data items that hold document values:<br /><br /> * Multiple PDF documents are associated with the attachments key word; therefore, the value for the attachments key needs to be a listdata item that holds the document values.<br /> * Data items in a map must be of the same type; therefore, although only one document is used as a cover page, the value for the cover key needs to be a list data item.<br /><br />Especially the last part made me believe that it was OK to use a list with only one element.<br /><br />Can you explain how I should understand the above?<br /><br />Thanks in advance<br /><br />Sincerely<br />Kim

Avatar

Level 10
Each PDF source tag represents another PDF that is beinng assembled. So the PDF source="cover" means that it is reading in a PDF file that represents the cover of the doc.

Avatar

Level 8
Level 8
Hi again Paul,<br /><br />My DDX file look very similar to the one above, in fact it looks like this:<br /><br /><?xml version="1.0" encoding="UTF-8"?><br /> <DDX xmlns="http://ns.adobe.com/DDX/1.0/"><br /> <PDF result="GeneratedDocument"><br /> <PackageFiles><br /> <PDF source="attachments"/><br /> </PackageFiles><br /> </PDF><br /> </DDX> <br /><br />so if I change my DDX file to the following would I illiminate the error?<br /><br /><?xml version="1.0" encoding="UTF-8"?><br /> <DDX xmlns="http://ns.adobe.com/DDX/1.0/"><br /> <PDF result="GeneratedDocument"><br /> <PDF source="attachments"/><br /> </PDF><br /> </DDX><br /><br />in both the above ddx files attachments is a map containing one or more lists.<br /><br />Sincerely<br />Kim

Avatar

Level 10
I do not think so .....Assembler will only accept a list. Also you really haven't solved the root problem of only sending one doc for assembling.

Avatar

Level 8
Level 8
No, you are right there. So I have to make a check to see if the length of the collection is above one. In this case I must not send the document to assembler but do something else.



Thanks for your help - I really appreciate it.



Sincerely

Kim

Avatar

Level 6
I am having a similar problem where I am passing a map of documents to a sub process of a workflow. If there is more than one item in the map, it works fine. If there is only one, it seems that just the single document is passed and I get InvalidCoercionException.