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

Avatar

Avatar

sdk60873563

Avatar

sdk60873563

sdk60873563

29-01-2019

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

sdk60873563

Avatar

sdk60873563

sdk60873563

31-01-2019

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.

Answers (3)

Answers (3)

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K
smacdonald2008

29-01-2019

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

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K
smacdonald2008

29-01-2019

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...