Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Tagging programmatically - error: Caused by: java.lang.RuntimeException:

Avatar

Level 2

I am getting this error while trying to tag assets: (tagmanager.setTags(resource, new Tag[list.size()]))

Caused by: java.lang.RuntimeException: error while setting tags for '/content/dam/myproject/R_Ucal_10112012.pdf

Caused by: javax.jcr.version.VersionException: Cannot set property. Node is checked in.

I am not able to figure out what this exception is. Please help me out.

 

Regards,

Vishal

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi,

I can't see the image you uploaded to your last post.

When uploading that many assets, you have to be aware of the processes going on in the background, For every PDF you are uploading, an instance of the DAM Update Asset workflow is kicked off. If you upload all your assets at once, then obviously this will create a lot of workflows. If you were to try and update a PDF that was still being processed by a workflow, then you could end up with the error you saw. Ideally you should wait till the workflow has processed the asset before attempting to modify it, which is obviously hard to determine with so many assets/workflows.

I would try uploading say 10 PDF's, wait for the workflows to complete, check "/workflow/content/console.html", then run your script and see if all the files get updated.

Link[1] gives some information on how to upload a large number of assets, you can use import throttling to upload in batches.Link[2] outlines various performance issues with the DAM and how they affect the system as a whole.

Another option is to disable the DAM Update Asset workflow for the initial import, then enable it and use a script to go through the uploaded files to kick off the workflow. But review the links below and come back with any questions you may have.

Regards,

Opkar

[1] https://docs.adobe.com/docs/en/cq/5-6-1/deploying/scaling.html

[2] http://docs.adobe.com/docs/en/aem/6-1/deploy/configuring/performance/assets-performance-sizing.html

View solution in original post

8 Replies

Avatar

Employee

Hi,

are these existing PDF's in your DAM, or did you upload them and trying to immediately tag them?

Can you post/attach the full exception.

Regards,

Opkar

Avatar

Level 10

Are all PDFs in that location give the same exception or only this one. Try tagging the other PDFs (upload some of there are not others) - sometimes testing in this manner gives clues to why an exception is being thrown.   

Avatar

Level 10

Do you see this pdf 'R_Ucal_10112012.pdf' uploaded ??

which AEM version are you using ?

Avatar

Level 2

Thanks for your suggestion. Its causing for most of the pdf's. I had tried setting tags on other pdf's before but they did not throw any exception. There is a property "jcr:isCheckedOut" set to false on these pdfs. I am not sure how and when this gets set to false. Then there are others set to true. 

I tried using versionManager to checkout this resource before tagging, but I am not able to get the version manager working.

Avatar

Level 2

Hi I uploaded them through WebDAV. The number of pdf files were 45,000 approx. Then, yes I tried to tag them as all the required sub folders were created (eg. metadata, jcr:content etc). Then I ran my script that uses Tagmanager API to tag these pdfs. 

 
I am not sure if I have to wait after uploading these assets. If I need to wait then for how long?
 
Please find below the error:
 
Inline image 1

Avatar

Correct answer by
Employee

Hi,

I can't see the image you uploaded to your last post.

When uploading that many assets, you have to be aware of the processes going on in the background, For every PDF you are uploading, an instance of the DAM Update Asset workflow is kicked off. If you upload all your assets at once, then obviously this will create a lot of workflows. If you were to try and update a PDF that was still being processed by a workflow, then you could end up with the error you saw. Ideally you should wait till the workflow has processed the asset before attempting to modify it, which is obviously hard to determine with so many assets/workflows.

I would try uploading say 10 PDF's, wait for the workflows to complete, check "/workflow/content/console.html", then run your script and see if all the files get updated.

Link[1] gives some information on how to upload a large number of assets, you can use import throttling to upload in batches.Link[2] outlines various performance issues with the DAM and how they affect the system as a whole.

Another option is to disable the DAM Update Asset workflow for the initial import, then enable it and use a script to go through the uploaded files to kick off the workflow. But review the links below and come back with any questions you may have.

Regards,

Opkar

[1] https://docs.adobe.com/docs/en/cq/5-6-1/deploying/scaling.html

[2] http://docs.adobe.com/docs/en/aem/6-1/deploy/configuring/performance/assets-performance-sizing.html

Avatar

Level 10

I have not had an issue tagging content using TagManager API. 

https://helpx.adobe.com/experience-manager/using/tagmanager.html

However - never have I tried that many assets - 45 K. 

Avatar

Level 10

Upload assets in batches & make sure to run your custom code to update asset after workflow is completed. Also ensure latest service pack is installed.