Hello,

to second what Shane wrote I can say that I'm in the same situation:
It's not possible to clone nodes with children in Jackrabbit 1.1.1.
Stefan, can you please reopen JCR-452 as Shane suggested? I already
tried it but I guess only you can do it as you are the Assignee.
Here are the Jira link and the discussion link for your convenience:
https://issues.apache.org/jira/browse/JCR-452
http://www.mail-archive.com/[email protected]/msg03706.html

This is a test case that reproduces the issue in my environment:
Node node1 = tempSession.getRootNode().addNode("node1");
node1.addMixin("mix:referenceable");
Node node2 =node1.addNode("node2");
node2.addMixin("mix:referenceable");
tempSession.save();
lifeSession.getWorkspace().clone("temp",
node1.getPath(),node1.getPath(), true);

It would probably fit good in the
org.apache.jackrabbit.test.api.WorkspaceCloneReferenceableTest.
At the moment I have no compileable environment to improve the 
test cases. But maybe this information already helps if someone 
would like to to do so.
I hope this helps a bit to fix the issue.

Best regards,

Sandro



Shane Preater schrieb:
> Hi I am using jackrabbit and require the ability to clone nodes and
their
> children from a development workspace to a live workspace.
>
> I am having the following problem when trying to clone a simple node
with a
> single child using the 1.1.1 released version of Jackrabbit:
>
> javax.jcr.ItemNotFoundException: failed to build path of
> a2988d4b-429e-4c82-9f4e-5c0f4f799f9f:
cafebabe-cafe-babe-cafe-babecafebabe
> has no child entry for a2988d4b-429e-4c82-9f4e-5c0f4f799f9f
>    at org.apache.jackrabbit.core.HierarchyManagerImpl.buildPath(
> HierarchyManagerImpl.java:309)
>    at org.apache.jackrabbit.core.CachingHierarchyManager.buildPath(
> CachingHierarchyManager.java:160)
>    at org.apache.jackrabbit.core.HierarchyManagerImpl.getPath(
> HierarchyManagerImpl.java:358)
>    at org.apache.jackrabbit.core.CachingHierarchyManager.getPath(
> CachingHierarchyManager.java:222)
>    at org.apache.jackrabbit.core.CachingHierarchyManager.nodeAdded(
> CachingHierarchyManager.java:351)
>    at
>
org.apache.jackrabbit.core.state.StateChangeDispatcher.notifyNodeAdded(
> StateChangeDispatcher.java:152)
>    at
org.apache.jackrabbit.core.state.SessionItemStateManager.nodeAdded(
> SessionItemStateManager.java:829)
>    at
>
org.apache.jackrabbit.core.state.StateChangeDispatcher.notifyNodeAdded(
> StateChangeDispatcher.java:152)
>    at
org.apache.jackrabbit.core.state.LocalItemStateManager.nodeAdded(
> LocalItemStateManager.java:479)
>    at org.apache.jackrabbit.core.state.NodeState.notifyNodeAdded(
> NodeState.java:788)
>    at org.apache.jackrabbit.core.state.NodeState.addChildNodeEntry(
> NodeState.java:377)
>    at org.apache.jackrabbit.core.BatchedItemOperations.copyNodeState(
> BatchedItemOperations.java:1674)
>    at org.apache.jackrabbit.core.BatchedItemOperations.copy(
> BatchedItemOperations.java:311)
>    at org.apache.jackrabbit.core.WorkspaceImpl.internalCopy(
> WorkspaceImpl.java:298)
>    at
org.apache.jackrabbit.core.WorkspaceImpl.clone(WorkspaceImpl.java
> :405)
>    at org.apache.jackrabbit.rmi.server.ServerWorkspace.clone(
> ServerWorkspace.java:102)
>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>    at java.lang.reflect.Method.invoke(Unknown Source)
>    at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
>    at sun.rmi.transport.Transport$1.run(Unknown Source)
>    at java.security.AccessController.doPrivileged(Native Method)
>    at sun.rmi.transport.Transport.serviceCall(Unknown Source)
>    at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown
Source)
>    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown
> Source)
>    at java.lang.Thread.run(Unknown Source)
>
> I have simply created two workspaces one called 'clonetest' and the
other
> 'clonedestination'
> I then created a node called 'test-node' and then cloned this
successfully
>> from clonetest to clonedestination.
> I then created a node in clonetest which is a child of 'test-node'
called
> 'child'.
>
> When trying to then clone test-node from clonetest to clonedestination
again
> I am getting the above exception.
>
> public void testWorkspaceClone() throws Exception {
>        try {
>            ClientRepositoryFactory factory = new
ClientRepositoryFactory();
>            Repository repository = factory.getRepository
> (LOCALHOST_REPOSITORY);
>            Session shanoSession = repository.login(new
SimpleCredentials(
>                    "shane", "preater".toCharArray()),
"clonedestination");
>
>            String path = "/test-node";
>            shanoSession.getWorkspace().clone("clonetest", path, path,
> true);
>
>
>
>            shanoSession.save();
>            shanoSession.logout();
>        } catch (Exception e) {
>            e.printStackTrace();
>            throw e;
>        }
>    }
>
> I have seen that an error very similar to this was raised as JCR-452
and
> this was fixed for 1.1. Does this mean I am doing something wrong or,
should
> I re-open the JIRA issue?
>
> Kind regards,
> Shane.
>

Reply via email to