Skip to main content
Level 2
Nov 8, 2021 8:14 PM UTC
Solved

Getting persistent exception while trying to commit using resourceResolver.commit()

 

Getting Persistent exception in the highlighted line of code. 'stageAssetPath' and 'destinationAssetFilePath' are coming correct. Any idea what could be the cause?

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Asutosh_Jena_
Asutosh_Jena_Accepted solution
Community Advisor
Nov 9, 2021 2:36 AM UTC

Please add a check if there are changes in resource resolver and then call the commit().

 

if (resourceResolver.hasChanges()) {
resourceResolver.commit();
}

 

Also without removing the asset, cannot you move the asset to the destination? It's a move operation so it should work.

 

Thanks!

3 replies

Asutosh_Jena_
Community Advisor
Asutosh_Jena_Community AdvisorAccepted solution
Community Advisor
Nov 9, 2021 2:36 AM UTC

Please add a check if there are changes in resource resolver and then call the commit().

 

if (resourceResolver.hasChanges()) {
resourceResolver.commit();
}

 

Also without removing the asset, cannot you move the asset to the destination? It's a move operation so it should work.

 

Thanks!

Translate
Adobe Employee
Nov 9, 2021 5:44 AM UTC

Hi @p_v_nair ,

 

Please check below link

org.apache.sling.api.resource.ResourceResolver.commit java code examples | Tabnine

 

Hope this helps!!
Thanks

Translate
joerghoh
Adobe Employee
Adobe Employee
Nov 11, 2021 6:33 PM UTC

Can you please share the complete exception, at best including the stacktrace?

Translate