0 Replies Latest reply on Mar 29, 2013 3:51 PM by Satya M

    VersionException when merging workspaces

    Satya M Newbie

      I am running into the following exception when I try to merge two workspaces.

       

      15:43:40,522 ERROR [stderr] (http--127.0.0.1-8080-1) javax.jcr.version.VersionException: Cannot add the child node named 'child2' under '/parent1' because it is checked in and the child's node definition '*' has an on-parent-version attribute of 'VERSION' (must be 'ignore' to add child to checked-in parent)

      15:43:40,522 ERROR [stderr] (http--127.0.0.1-8080-1)           at org.modeshape.jcr.AbstractJcrNode.addChildNode(AbstractJcrNode.java:1050)

      15:43:40,538 ERROR [stderr] (http--127.0.0.1-8080-1)           at org.modeshape.jcr.JcrWorkspace.copy(JcrWorkspace.java:193)

      15:43:40,538 ERROR [stderr] (http--127.0.0.1-8080-1)           at org.modeshape.jcr.JcrVersionManager$MergeCommand.doUpdate(JcrVersionManager.java:1746)

      15:43:40,553 ERROR [stderr] (http--127.0.0.1-8080-1)           at org.modeshape.jcr.JcrVersionManager$MergeCommand.doMerge(JcrVersionManager.java:1696)

      15:43:40,553 ERROR [stderr] (http--127.0.0.1-8080-1)           at org.modeshape.jcr.JcrVersionManager$MergeCommand.doUpdate(JcrVersionManager.java:1762)

      15:43:40,553 ERROR [stderr] (http--127.0.0.1-8080-1)           at org.modeshape.jcr.JcrVersionManager$MergeCommand.doMerge(JcrVersionManager.java:1685)

      15:43:40,569 ERROR [stderr] (http--127.0.0.1-8080-1)           at org.modeshape.jcr.JcrVersionManager$MergeCommand.execute(JcrVersionManager.java:1656)

      15:43:40,569 ERROR [stderr] (http--127.0.0.1-8080-1)           at org.modeshape.jcr.JcrVersionManager.merge(JcrVersionManager.java:939)

      15:43:40,585 ERROR [stderr] (http--127.0.0.1-8080-1)           at org.modeshape.jcr.JcrVersionManager.merge(JcrVersionManager.java:783)

      15:43:40,585 ERROR [stderr] (http--127.0.0.1-8080-1)           at org.modeshape.jcr.JcrVersionManager.merge(JcrVersionManager.java:768)

       

      Following are CND and code details

       

      CND

      [Parent] > mix:versionable

        - name (string) copy

        + * (Child) version

       

      [Child] > mix:versionable

        - name (string) copy

       

      Code

      session = repository.login("default"); // Logging into default workspace

       

       

      Node root = session.getRootNode();

      VersionManager vm = session.getWorkspace().getVersionManager();

       

       

      Node parent1 = root.addNode("parent1", "Parent");

      session.save();

      vm.checkin(parent1.getPath());

       

       

      vm.checkout(parent1.getPath());

      Node child1 = parent1.addNode("child1", "Child"); // adding a child node under parent1

      session.save();

      vm.checkin(child1.getPath());

      vm.checkin(parent1.getPath());

       

      session.getWorkspace().createWorkspace("clone", "default"); // creating clone workspace

      session = repository.login("clone"); // logging into clone workspace

      vm = session.getWorkspace().getVersionManager();

       

      vm.checkout("/parent1");

      Node child2 = session.getNode("/parent1").addNode("child2", "Child"); // adding a new child node under parent1 in cloned workspace

      session.save();

      vm.checkin("/parent1/child2");

      vm.checkin("/parent1");

       

      session = repository.login("default");

      vm = session.getWorkspace().getVersionManager();

      vm.merge("/", "clone", false); // merging into default workspace is throwing exception

       

      Am I doing some thing wrong here??