Hi,
I am trying to rename a node using session.move() method, but getting the following error:
CODE:
ERROR:
javax.jcr.InvalidItemStateException: OakState0001: Unresolved conflicts in /content/dam/torrid/pdp-assets/138/861/13886120/06452/Trash
at org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:238) [org.apache.jackrabbit.oak-api:1.22.6]
at org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:213) [org.apache.jackrabbit.oak-api:1.22.6]
at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.newRepositoryException(SessionDelegate.java:669) [org.apache.jackrabbit.oak-jcr:1.22.6]
at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:495) [org.apache.jackrabbit.oak-jcr:1.22.6]
at org.apache.jackrabbit.oak.jcr.session.SessionImpl$8.performVoid(SessionImpl.java:424) [org.apache.jackrabbit.oak-jcr:1.22.6]
at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performVoid(SessionDelegate.java:273) [org.apache.jackrabbit.oak-jcr:1.22.6]
at org.apache.jackrabbit.oak.jcr.session.SessionImpl.save(SessionImpl.java:421) [org.apache.jackrabbit.oak-jcr:1.22.6]
at com.adobe.granite.repository.impl.CRX3SessionImpl.save(CRX3SessionImpl.java:208) [com.adobe.granite.repository:1.6.28.CQ650-B0001]
Any help would be appreciated.
Thanks,
Nandan
Views
Replies
Total Likes
Hi @nandan123 , This occurs when resource is modified by concurrent sessions.
Can you try session.refresh(true) before saving the session.
Hope this helps,
Krishna
Hi @krishna_sai , thanks for your reply
I added
There is no explicit method to rename node in JCR, It can be done only by move method.
Since move method change the order of node but It can be reorder.
JCR 2.0: 23 Orderable Child Nodes (Content Repository for Java Technology API v2.0)
@Jagadeesh_Prakash Thank you for your reply,
When I try renaming a node, getting this ERROR, how do I solve this?
@nandan123 where is the error?
javax.jcr.InvalidItemStateException: OakState0001: Unresolved conflicts in /content/dam/torrid/pdp-assets/138/861/13886120/06452/Trash
at org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:238) [org.apache.jackrabbit.oak-api:1.22.6]
at org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:213) [org.apache.jackrabbit.oak-api:1.22.6]
at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.newRepositoryException(SessionDelegate.java:669) [org.apache.jackrabbit.oak-jcr:1.22.6]
at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:495) [org.apache.jackrabbit.oak-jcr:1.22.6]
Hi @nandan123 ,
Since the issue is because of multiple sessions/threads are concurrently trying to access/update the same node, I think you should consider using Synchronization (Synchronized method in OSGI Service). This will make sure that the code is not being executed in parallel. Though this might hit performance so just be cautious.
BTW, what is the use case where the code is being executed, workflow?
Good reads-
https://blogs.perficient.com/2017/12/05/2-common-concurrency-pitfalls-in-aem-and-how-to-avoid-them/
https://www.javatpoint.com/synchronization-in-java
Thanks,
Ritesh Mittal
@Ritesh_Mittal Thank you for your reply,
This code is a part of service which is called in a servlet.
I tried adding synchronized for this method, still getting same error.
Views
Likes
Replies
Views
Likes
Replies