You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Felix Röthenbacher <fe...@wyona.com> on 2005/04/08 21:51:44 UTC

PathNotFoundException when copying between workspaces

Hi

as mentioned before, I get a PathNotfoundException
when I try to copy a node from one workspace to
another. Here is the programme excecution:

1. Open session sA with workspace wA
2. Create a new node nA in workspace wA
3. Call sA.save() (afterwards it reports no pending changes)
4. Open session sB with workspace wB
5. Call wB.copy(wA, nA, [dstPath])
6. A PathNotFoundException is thrown

Funny thing is, that when I restart the repository
instance after node creation, this procedure works.

Thanks for sheding light on this

- Felix

Re: PathNotFoundException when copying between workspaces

Posted by Felix Röthenbacher <fe...@wyona.com>.
Thanks a lot! It works now ...

Obviously, by registering the repository twice with
RegistryHelper.registerRepository two separate repository
instances were created (and I set overwrite to true
so no NameAlreadyBoundException was thrown :-/

- Felix


Stefan Guggisberg wrote:
> hi felix, 
> 
> my guess is that you somehow have 2 different Repository instances 
> that were created using identical configurations, i.e. they are
> reading from/writing to
> the same physical storage. this setup is not supported and will lead to 
> corrupt data.
> 
> cheers
> stefan
> 
> On Apr 11, 2005 4:35 PM, Felix Röthenbacher
> <fe...@wyona.com> wrote:
> 
>>Hi Stefan
>>
>>i tracked it down to the HierarchyManagerImpl class. There,
>>resolvePath() [199] is called for the source path (e.g. '/site/test',
>>where 'test' is a newly added or copied node).
>>
>>The execution path is as follows:
>>
>>[199] resolvePath(Path path)
>>[222] for (...)
>>         [iterate over all path elements]
>>[226]   parentState.hasChildNodeEntry(...) => false for name='test'
>>[241]   parentState.hasProperty(...) => false for name='test'
>>[253]   PathNotFoundException
>>
>>Actually, the NodeState.ChildNodeEntries of 'site's parentState
>>does not reflect the newly added node.
>>
>>Unfortunately, I can't reproduce it with a simple setup for
>>now ...
>>
>>As said before, after a restart of the repository after adding
>>the node, it can be copied without a problem (with same code
>>sequence!!).
>>
>>Regards,
>>
>>Felix
>>
>>
>>Stefan Guggisberg wrote:
>>
>>>i tested what you're describing with the following code fragment:
>>>
>>>    Session sA = r.login(new SimpleCredentials("johndoe",
>>>"".toCharArray()), "A");
>>>    Session sB = r.login(new SimpleCredentials("johndoe",
>>>"".toCharArray()), "B");
>>>    Node nA = sA.getRootNode().addNode("foo");
>>>    sA.save();
>>>    Workspace wB = sB.getWorkspace();
>>>    wB.copy("A", nA.getPath(), "/bar");
>>>
>>>everything worked as expected.
>>>
>>>are you sure you're logging in on the same Repository instance?
>>>
>>>cheers
>>>stefan
>>>
>>>
>>>On Apr 8, 2005 9:51 PM, Felix Röthenbacher
>>><fe...@wyona.com> wrote:
>>>
>>>
>>>>Hi
>>>>
>>>>as mentioned before, I get a PathNotfoundException
>>>>when I try to copy a node from one workspace to
>>>>another. Here is the programme excecution:
>>>>
>>>>1. Open session sA with workspace wA
>>>>2. Create a new node nA in workspace wA
>>>>3. Call sA.save() (afterwards it reports no pending changes)
>>>>4. Open session sB with workspace wB
>>>>5. Call wB.copy(wA, nA, [dstPath])
>>>>6. A PathNotFoundException is thrown
>>>>
>>>>Funny thing is, that when I restart the repository
>>>>instance after node creation, this procedure works.
>>>>
>>>>Thanks for sheding light on this
>>>>
>>>>- Felix
>>>>
>>>
>>>
> 


-- 
Felix Röthenbacher                  felix.roethenbacher@wyona.com
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org

Re: PathNotFoundException when copying between workspaces

Posted by Stefan Guggisberg <st...@gmail.com>.
hi felix, 

my guess is that you somehow have 2 different Repository instances 
that were created using identical configurations, i.e. they are
reading from/writing to
the same physical storage. this setup is not supported and will lead to 
corrupt data.

cheers
stefan

On Apr 11, 2005 4:35 PM, Felix Röthenbacher
<fe...@wyona.com> wrote:
> Hi Stefan
> 
> i tracked it down to the HierarchyManagerImpl class. There,
> resolvePath() [199] is called for the source path (e.g. '/site/test',
> where 'test' is a newly added or copied node).
> 
> The execution path is as follows:
> 
> [199] resolvePath(Path path)
> [222] for (...)
>          [iterate over all path elements]
> [226]   parentState.hasChildNodeEntry(...) => false for name='test'
> [241]   parentState.hasProperty(...) => false for name='test'
> [253]   PathNotFoundException
> 
> Actually, the NodeState.ChildNodeEntries of 'site's parentState
> does not reflect the newly added node.
> 
> Unfortunately, I can't reproduce it with a simple setup for
> now ...
> 
> As said before, after a restart of the repository after adding
> the node, it can be copied without a problem (with same code
> sequence!!).
> 
> Regards,
> 
> Felix
> 
> 
> Stefan Guggisberg wrote:
> > i tested what you're describing with the following code fragment:
> >
> >     Session sA = r.login(new SimpleCredentials("johndoe",
> > "".toCharArray()), "A");
> >     Session sB = r.login(new SimpleCredentials("johndoe",
> > "".toCharArray()), "B");
> >     Node nA = sA.getRootNode().addNode("foo");
> >     sA.save();
> >     Workspace wB = sB.getWorkspace();
> >     wB.copy("A", nA.getPath(), "/bar");
> >
> > everything worked as expected.
> >
> > are you sure you're logging in on the same Repository instance?
> >
> > cheers
> > stefan
> >
> >
> > On Apr 8, 2005 9:51 PM, Felix Röthenbacher
> > <fe...@wyona.com> wrote:
> >
> >>Hi
> >>
> >>as mentioned before, I get a PathNotfoundException
> >>when I try to copy a node from one workspace to
> >>another. Here is the programme excecution:
> >>
> >>1. Open session sA with workspace wA
> >>2. Create a new node nA in workspace wA
> >>3. Call sA.save() (afterwards it reports no pending changes)
> >>4. Open session sB with workspace wB
> >>5. Call wB.copy(wA, nA, [dstPath])
> >>6. A PathNotFoundException is thrown
> >>
> >>Funny thing is, that when I restart the repository
> >>instance after node creation, this procedure works.
> >>
> >>Thanks for sheding light on this
> >>
> >>- Felix
> >>
> >
> >
>

Re: PathNotFoundException when copying between workspaces

Posted by Felix Röthenbacher <fe...@wyona.com>.
Hi Stefan

i tracked it down to the HierarchyManagerImpl class. There,
resolvePath() [199] is called for the source path (e.g. '/site/test',
where 'test' is a newly added or copied node).

The execution path is as follows:

[199] resolvePath(Path path)
[222] for (...)
         [iterate over all path elements]
[226]   parentState.hasChildNodeEntry(...) => false for name='test'
[241]   parentState.hasProperty(...) => false for name='test'
[253]   PathNotFoundException

Actually, the NodeState.ChildNodeEntries of 'site's parentState
does not reflect the newly added node.

Unfortunately, I can't reproduce it with a simple setup for
now ...

As said before, after a restart of the repository after adding
the node, it can be copied without a problem (with same code
sequence!!).

Regards,

Felix



Stefan Guggisberg wrote:
> i tested what you're describing with the following code fragment:
> 
>     Session sA = r.login(new SimpleCredentials("johndoe",
> "".toCharArray()), "A");
>     Session sB = r.login(new SimpleCredentials("johndoe",
> "".toCharArray()), "B");
>     Node nA = sA.getRootNode().addNode("foo");
>     sA.save();
>     Workspace wB = sB.getWorkspace();
>     wB.copy("A", nA.getPath(), "/bar");
> 
> everything worked as expected.
> 
> are you sure you're logging in on the same Repository instance?
> 
> cheers
> stefan
> 
> 
> On Apr 8, 2005 9:51 PM, Felix Röthenbacher
> <fe...@wyona.com> wrote:
> 
>>Hi
>>
>>as mentioned before, I get a PathNotfoundException
>>when I try to copy a node from one workspace to
>>another. Here is the programme excecution:
>>
>>1. Open session sA with workspace wA
>>2. Create a new node nA in workspace wA
>>3. Call sA.save() (afterwards it reports no pending changes)
>>4. Open session sB with workspace wB
>>5. Call wB.copy(wA, nA, [dstPath])
>>6. A PathNotFoundException is thrown
>>
>>Funny thing is, that when I restart the repository
>>instance after node creation, this procedure works.
>>
>>Thanks for sheding light on this
>>
>>- Felix
>>
> 
> 

Re: PathNotFoundException when copying between workspaces

Posted by Stefan Guggisberg <st...@gmail.com>.
i tested what you're describing with the following code fragment:

    Session sA = r.login(new SimpleCredentials("johndoe",
"".toCharArray()), "A");
    Session sB = r.login(new SimpleCredentials("johndoe",
"".toCharArray()), "B");
    Node nA = sA.getRootNode().addNode("foo");
    sA.save();
    Workspace wB = sB.getWorkspace();
    wB.copy("A", nA.getPath(), "/bar");

everything worked as expected.

are you sure you're logging in on the same Repository instance?

cheers
stefan


On Apr 8, 2005 9:51 PM, Felix Röthenbacher
<fe...@wyona.com> wrote:
> Hi
> 
> as mentioned before, I get a PathNotfoundException
> when I try to copy a node from one workspace to
> another. Here is the programme excecution:
> 
> 1. Open session sA with workspace wA
> 2. Create a new node nA in workspace wA
> 3. Call sA.save() (afterwards it reports no pending changes)
> 4. Open session sB with workspace wB
> 5. Call wB.copy(wA, nA, [dstPath])
> 6. A PathNotFoundException is thrown
> 
> Funny thing is, that when I restart the repository
> instance after node creation, this procedure works.
> 
> Thanks for sheding light on this
> 
> - Felix
>