LiveRelationshipManager error: No content resource for resource at path "/content/..."
Hi all.
Recently Im facing an issue when I try to retrieve all liveCopyRelationships related to a page:
LiveRelationshipManager liveRelationshipManager = resourceResolver.adaptTo(LiveRelationshipManager.class);
RangeIterator liveRelationships = liveRelationshipManager.getLiveRelationships(myPageResource, null, null);
These instructions retrieve me all liveCopyRelationships but recently it does not work anymore ONLY on publish envs.
The issue is raised when i loop my RangeIterator as follow:
LiveRelationship liveCopy = (LiveRelationship) liveRelationships.next();
For certain page contents i get this error:
java.lang.RuntimeException: com.day.cq.wcm.api.WCMException: javax.jcr.ItemNotFoundException: No content resource for resource at path /content/myContentPage
at com.day.cq.wcm.msm.impl.LiveRelationshipManagerImpl$LiveRelationshipIterator.next(LiveRelationshipManagerImpl.java:1152) [com.day.cq.wcm.cq-msm-core:5.13.60]
[...]
Caused by: com.day.cq.wcm.api.WCMException: javax.jcr.ItemNotFoundException: No content resource for resource at path /content/myContentPage
at com.day.cq.wcm.msm.impl.LiveRelationshipManagerImpl.buildRelationship(LiveRelationshipManagerImpl.java:869) [com.day.cq.wcm.cq-msm-core:5.13.60]
at com.day.cq.wcm.msm.impl.LiveRelationshipManagerImpl.access$100(LiveRelationshipManagerImpl.java:81) [com.day.cq.wcm.cq-msm-core:5.13.60]
at com.day.cq.wcm.msm.impl.LiveRelationshipManagerImpl$LiveRelationshipIterator.seek(LiveRelationshipManagerImpl.java:1107) [com.day.cq.wcm.cq-msm-core:5.13.60]
at com.day.cq.wcm.msm.impl.LiveRelationshipManagerImpl$LiveRelationshipIterator.next(LiveRelationshipManagerImpl.java:1150) [com.day.cq.wcm.cq-msm-core:5.13.60]
... 24 common frames omitted
Caused by: javax.jcr.ItemNotFoundException: No content resource for resource at path /content/myContentPage
at com.day.cq.wcm.msm.impl.Utils.getContentResource(Utils.java:214) [com.day.cq.wcm.cq-msm-core:5.13.60]
at com.day.cq.wcm.msm.impl.StatusUtil.createLiveStatus(StatusUtil.java:57) [com.day.cq.wcm.cq-msm-core:5.13.60]
at com.day.cq.wcm.msm.impl.LiveRelationshipManagerImpl.buildRelationship(LiveRelationshipManagerImpl.java:856) [com.day.cq.wcm.cq-msm-core:5.13.60]
... 27 common frames omitted
I cannot skip this error because raised exception is a runtimeException so i'd prefer to understand why this exception occurred rather than catch it with a generic Exception.
I really cannot understand in which scenario this could happen. Do you think that some content has been deleted on publish server? How could the liveCopyRelationship have been broken?
Can someone help me to understand why often this issue appears?
Thanks in advance.