jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Campbell <rrc...@gmail.com>
Subject Re: How to get the versionable node from its fronzen node?
Date Fri, 03 Sep 2010 12:41:57 GMT
I'd like to open this thread back up because we're performing the
exact operation Sébastien outlined, but we're getting the
ItemNotFoundException from JCR-134 in Jackrabbit 2.1.1.

In our case the versionable node was not removed, but rather just
added for the first time. We have registered listeners with the for
NODE_ADDED events on the "/jcr:system/jcr:versionStorage" path.
Basically we're listening for new versions being added. When a new
_versionable_ node is added, the onEvent in the listeners is correctly
invoked based on a new _version_ (frozen) node being added for that
head/versionable node. When we run Sébastien's code to retrieve the
headNode from the frozenNode, we get an ItemNotFoundException.
Curiously, adding a Thread.sleep() actually solves the problem, so
there must be some transient/race condition occurring. Here is the

            final Node frozenNode = getNodeBy(forzenNodePath, session);
            final String headNodeIdentifier =
            return session.getNodeByIdentifier(headNodeIdentifier).getPath();

Is this a bug? Or are we simply doing something incorrectly?

- Rob Campbell

On Fri, Feb 5, 2010 at 8:24 PM, Sébastien Launay
<sebastienlaunay@gmail.com> wrote:
> Hi,
> 2010/2/5 Niu, Xuetao <Xuetao.Niu@fiserv.com>:
>> Hello,
>> I am looking through the version history of a versionable node, and I
>> don't have a reference to the versionable node. How can I find the
>> versionable node from the frozen nodes in its versioning history
> You can retrieve the versionable node from the frozenNode with the
> following code:
> Node headNode =
> session.getNodeByIdentifier(frozenNode.getProperty("jcr:frozenUuid"));
> // use session.getNodeByUUID with JCR 1.0
> This code might throw an ItemNotFoundException if the "head" node has
> been removed but still has versions in the history, see [1] for more information
> about this.
> [1] http://issues.apache.org/jira/browse/JCR-134
> --
> Sébastien Launay

View raw message