Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2609

Exception on getting a node from jcr:childVersionHistory

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 5.1.0.Final
    • 5.0.0.Final
    • JCR
    • None
    • Hide

      Utilize the attached project, i.e. modeshape-version-test.zip.

      Show
      Utilize the attached project, i.e. modeshape-version-test.zip .
    • Workaround Exists
    • Hide

      Do not read protected node properties explicitly and instead use the JCR public versioning API. In this particular case, use VersionManager#getVersionHistory

      Show
      Do not read protected node properties explicitly and instead use the JCR public versioning API. In this particular case, use VersionManager#getVersionHistory

      Background

      There is a project that runs on Jackrabbit 2.x. Due to concurrency issues even with explicit locking (and some others), it has been decided to migrate to ModeShape 5.x. So far, almost everything looks great and the problems we experienced with Jackrabbit before no longer happen with ModeShape, based on initial testing. However, there are some test cases that fail due to unexpected exception from ModeShape when working with the version history for a given frozen node. It is possible that the JCR API is misued in the project I am working on, but that specific functionality used to work when Jackrabbit was the implementation of the JCR 2.0.

      Problem

      Basically, what happens is that javax.jcr.PathNotFoundException gets thrown on a call like this:

      VersionHistory versionHistory = (VersionHistory) child.getProperty("jcr:childVersionHistory").getNode();
      

      The stack trace looks like this:

      javax.jcr.ItemNotFoundException: No node exists at path 'dbb11dd317f1e7587ac6a4-441a-4cdb-a4b9-32bfe41cf9a9' in workspace "default"
      	at org.modeshape.jcr.AbstractJcrProperty.valueToNode(AbstractJcrProperty.java:397)
      	at org.modeshape.jcr.JcrSingleValueProperty.getNode(JcrSingleValueProperty.java:122)
      	
        ...
        
      Caused by: javax.jcr.PathNotFoundException: No node exists at path 'dbb11dd317f1e7587ac6a4-441a-4cdb-a4b9-32bfe41cf9a9' in workspace "default"
      	at org.modeshape.jcr.JcrSession.cachedNode(JcrSession.java:617)
      	at org.modeshape.jcr.JcrSession.node(JcrSession.java:649)
      	at org.modeshape.jcr.AbstractJcrProperty.valueToNode(AbstractJcrProperty.java:391)
      	... 29 more
      

      Test Case

      The aforementioned problem can be consistently re-created using the attached test project (see modeshape-version-test.zip). To run a project, unpack it and execute the following command:

      mvn clean verify
      

      Here are the versions of OS, Maven and Java in use:

      Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T06:57:37-05:00)
      Java version: 1.8.0_60, vendor: Oracle Corporation
      OS name: "mac os x", version: "10.10.4", arch: "x86_64", family: "mac"
      

      Questions

      Could someone take a look at the attached test project and provide feedback as to whether the behavior I see is expected? If ModeShape behaves according to the design, would you be able to point to a place in the test project where the JCR API is misused (and if so, give a hint on how to use it properly)? Thanks a lot.

              hchiorean Horia Chiorean (Inactive)
              illia.khokholkov Illia Khokholkov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: