Expand my Community achievements bar.

SOLVED

Unable to create revision while metadata of asset is being set which was uploaded by assetManager api

Avatar

Level 2

Hi,

I have uploaded asset programatically by assetManager api and I am trying to set metadata properties for that asset. While doing this, i get following exception due to which few out of the box properties are not getting updated for the asset(ex. jcr:lastModified).

I tried checking damAssetState property , if its 'processed' i will be doing further actions on asset.

Resource assetData = resourceResolver.getResource(damPath + "/jcr:content");

while(someTimer){

String assetState = (String) assetData.getValueMap().getOrDefault("dam:assetState", "");

if (assetState.equalsIgnoreCase("processed")) {

// break loop and  do next actions

}

}

Still i get same error and version doesnt get created. I feel 'dam-xmp-writeback' tries to send changes to renditions as soon as metadata node is modified. I do not have concrete solution yet. could you please let me know if you have nay thoughts on this?

Logs:

29.01.2019 17:44:21.591 *ERROR* [JobHandler: /etc/workflow/instances/server0/2019-01-29/dam-xmp-writeback_47:/content/dam/testfolder/t/te/test-3/sampleDocument.pdf/jcr:content/metadata] com.day.cq.dam.core.impl.handler.xmp.NCommXMPHandler Failed to create version for Asset /content/dam/testfolder/t/te/test-3/sampleDocument.pdf

java.lang.Exception: Unable to create revision.

at com.day.cq.dam.core.impl.AssetManagerImpl.createRevision(AssetManagerImpl.java:382)

at com.day.cq.dam.core.impl.AssetImpl.createRevision(AssetImpl.java:436)

at com.day.cq.dam.core.impl.handler.xmp.NCommXMPHandler.version(NCommXMPHandler.java:301)

at com.day.cq.dam.core.impl.handler.xmp.NCommXMPHandler.writeXmp(NCommXMPHandler.java:209)

at com.day.cq.dam.core.impl.handler.xmp.NCommXMPHandler.writeXmpMetadata(NCommXMPHandler.java:242)

at com.day.cq.dam.core.process.XMPWritebackProcess.writeXmp(XMPWritebackProcess.java:412)

at com.day.cq.dam.core.process.XMPWritebackProcess.execute(XMPWritebackProcess.java:196)

at com.day.cq.workflow.compatibility.CQWorkflowProcessRunner.execute(CQWorkflowProcessRunner.java:93)

at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:189)

at com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:258)

at org.apache.sling.event.impl.jobs.JobConsumerManager$JobConsumerWrapper.process(JobConsumerManager.java:500)

at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.startJob(JobQueueImpl.java:291)

at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.access$100(JobQueueImpl.java:58)

at org.apache.sling.event.impl.jobs.queues.JobQueueImpl$1.run(JobQueueImpl.java:227)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

Caused by: javax.jcr.InvalidItemStateException: OakState0001: Unresolved conflicts in /content/dam/testfolder/t/te/test-3/sampleDocument.pdf/jcr:content

at org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:237)

at org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:212)

at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.newRepositoryException(SessionDelegate.java:670)

at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:496)

at org.apache.jackrabbit.oak.jcr.session.SessionImpl$8.performVoid(SessionImpl.java:419)

at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performVoid(SessionDelegate.java:274)

at org.apache.jackrabbit.oak.jcr.session.SessionImpl.save(SessionImpl.java:416)

at com.adobe.granite.repository.impl.CRX3SessionImpl.save(CRX3SessionImpl.java:208)

at com.day.cq.dam.core.impl.AssetManagerImpl.createRevision(AssetManagerImpl.java:361)

... 16 common frames omitted

Caused by: org.apache.jackrabbit.oak.api.CommitFailedException: OakState0001: Unresolved conflicts in /content/dam/testfolder/t/te/test-3/sampleDocument.pdf/jcr:content

at org.apache.jackrabbit.oak.plugins.commit.ConflictValidator.failOnMergeConflict(ConflictValidator.java:115)

at org.apache.jackrabbit.oak.plugins.commit.ConflictValidator.propertyAdded(ConflictValidator.java:84)

at org.apache.jackrabbit.oak.spi.commit.CompositeEditor.propertyAdded(CompositeEditor.java:83)

at org.apache.jackrabbit.oak.spi.commit.EditorDiff.propertyAdded(EditorDiff.java:82)

at org.apache.jackrabbit.oak.segment.SegmentNodeState.compareProperties(SegmentNodeState.java:617)

at org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:480)

at org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:148)

at org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:555)

at org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:148)

at org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:555)

at org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:148)

at org.apache.jackrabbit.oak.segment.MapRecord.compare(MapRecord.java:415)

at org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:608)

at org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:148)

at org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:555)

at org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:148)

at org.apache.jackrabbit.oak.segment.MapRecord.compare(MapRecord.java:415)

at org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:608)

at org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:148)

at org.apache.jackrabbit.oak.segment.MapRecord.compare(MapRecord.java:415)

at org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:608)

at org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:148)

at org.apache.jackrabbit.oak.segment.MapRecord.compare(MapRecord.java:415)

at org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:608)

at org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:148)

at org.apache.jackrabbit.oak.segment.MapRecord.compare(MapRecord.java:415)

at org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:608)

at org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:148)

at org.apache.jackrabbit.oak.segment.MapRecord.compare(MapRecord.java:415)

at org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:608)

at org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:148)

at org.apache.jackrabbit.oak.segment.MapRecord.compare(MapRecord.java:415)

at org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:608)

at org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:148)

at org.apache.jackrabbit.oak.segment.MapRecord.compare(MapRecord.java:415)

at org.apache.jackrabbit.oak.segment.SegmentNodeState.compareAgainstBaseState(SegmentNodeState.java:608)

at org.apache.jackrabbit.oak.spi.commit.EditorDiff.process(EditorDiff.java:52)

at org.apache.jackrabbit.oak.spi.commit.EditorHook.processCommit(EditorHook.java:54)

at org.apache.jackrabbit.oak.spi.commit.CompositeHook.processCommit(CompositeHook.java:61)

at org.apache.jackrabbit.oak.spi.commit.CompositeHook.processCommit(CompositeHook.java:61)

at org.apache.jackrabbit.oak.segment.SegmentNodeStore$Commit.prepare(SegmentNodeStore.java:611)

at org.apache.jackrabbit.oak.segment.SegmentNodeStore$Commit.optimisticMerge(SegmentNodeStore.java:634)

at org.apache.jackrabbit.oak.segment.SegmentNodeStore$Commit.execute(SegmentNodeStore.java:690)

at org.apache.jackrabbit.oak.segment.SegmentNodeStore.merge(SegmentNodeStore.java:334)

at org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:249)

at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.commit(SessionDelegate.java:347)

at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:494)

... 21 common frames omitted

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi All,

I got the solution for this. There were multiple save sessions on metaDataNode, i reduced it to one.

Thank you all for your response.

View solution in original post

7 Replies

Avatar

Level 10

I will check this and see if I can reproduce this. I will post back my findings.

I will use this HELXP article as a starting point.

Adobe Experience Manager Help | Uploading files to Adobe Experience Manager 6.4 DAM using Asset Mana...

Avatar

Level 10

I am checking with the Asset team. One thing I noticed is there is no setAssetMetaData() on Asset API.

Avatar

Correct answer by
Level 2

Hi All,

I got the solution for this. There were multiple save sessions on metaDataNode, i reduced it to one.

Thank you all for your response.

Avatar

Level 2

Hi Mate,

Can you please tell me how you identify the multiple session and how did you fix this issue.?

Avatar

Level 3
@sdk60873563 Can you please tell how you identify the multiple session and how did you fix this issue?

Avatar

Level 1

Hi @sdk60873563,

 

Could you please tell me how can I fix this issue, I am also facing the same issue. Any would help would be appreciated.