You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Cory Prowse <co...@prowse.com> on 2010/08/05 10:41:57 UTC
createWorkspace throws PathNotFoundException
Hi,
I'm attempting to create a workspace from another srcWorkspace but it is throwing a PathNotFoundException on a node that is a child of the root.
This is on JackRabbit 2.1.0 deployed as a JCA.
I am essentially doing the following:
session = repository.login(new SimpleCredentials("admin1", "".toCharArray()), "default");
session.getRootNode().addNode("/example", NodeType.NT_UNSTRUCTURED);
session.save();
workspace.createWorkspace("staging", "default");
session.logout();
This throws a PathNotFoundException on "/example".
Not sure what to do from here, can anyone provide possible causes?
-- Cory
Re: createWorkspace throws PathNotFoundException
Posted by Cory Prowse <co...@prowse.com>.
Hi Alexander,
I have attached a comment to the issue (https://issues.apache.org/jira/browse/JCR-2701) with the requested example code that uses a fresh session.
It throws the exact same exception as before.
If no nodes are added to the initial workspace, then yes it succeeds in creating the new workspace.
However to be clear, I then get the exact same exception if I then add a node to the initial workspace and clone it across to the new one.
I've added another comment with this code example as well.
-- Cory
On 06/08/2010, at 6:16 PM, Alexander Klimetschek wrote:
> On Fri, Aug 6, 2010 at 01:03, Cory Prowse <co...@prowse.com> wrote:
>> Attempting to use a fresh session still causes the exception.
>
> Thanks for the bug. Could you also add the code for the case with the
> fresh session? What happens if you don't create the "example" node at
> all?
>
> Regards,
> Alex
>
> --
> Alexander Klimetschek
> alexander.klimetschek@day.com
Re: createWorkspace throws PathNotFoundException
Posted by Alexander Klimetschek <ak...@day.com>.
On Fri, Aug 6, 2010 at 01:03, Cory Prowse <co...@prowse.com> wrote:
> Attempting to use a fresh session still causes the exception.
Thanks for the bug. Could you also add the code for the case with the
fresh session? What happens if you don't create the "example" node at
all?
Regards,
Alex
--
Alexander Klimetschek
alexander.klimetschek@day.com
Re: createWorkspace throws PathNotFoundException
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On Fri, Aug 6, 2010 at 1:10 AM, Cory Prowse <co...@prowse.com> wrote:
> Oh, should have highlighted that I didn't assign it to a release (might have
> been a bit presumptuous), even though there was options for 2.1.1 (or 2.2.0).
No problem. We typically assign the fix version only when the issue
has been fixed, or if there's a need to block a release until the fix
exists.
BR,
Jukka Zitting
Re: createWorkspace throws PathNotFoundException
Posted by Cory Prowse <co...@prowse.com>.
Oh, should have highlighted that I didn't assign it to a release (might have been a bit presumptuous), even though there was options for 2.1.1 (or 2.2.0).
-- Cory
On 06/08/2010, at 9:03 AM, Cory Prowse wrote:
> Attempting to use a fresh session still causes the exception.
>
> I've created issue JCR-2701:
> https://issues.apache.org/jira/browse/JCR-2701
>
> Key: JCR-2701
> Type: Bug
> Status: Open
> Priority: Major
> Assignee: Unassigned
> Component/s: jackrabbit-core
> Affects Version/s: 2.1.0
> Fix Version/s: None
> Environment: Jackrabbit is deployed using released JCA on Glassfish 3.0.1
>
> -- Cory
>
> On 06/08/2010, at 2:19 AM, Alexander Klimetschek wrote:
>
>> On Thu, Aug 5, 2010 at 13:57, Cory Prowse <co...@prowse.com> wrote:
>>> Sorry, I should have given a full example of the problem code.
>>> The following code fails on a fresh setup.
>>>
>>> @Startup
>>> @Singleton
>>> public class JcrStartupSingleton {
>>>
>>> @Resource(name = "jcr/repository", type = javax.jcr.Repository.class)
>>> private Repository repository;
>>>
>>> @PostConstruct
>>> public void setupWorkspaces() throws RepositoryException {
>>> final Session session = repository.login(new SimpleCredentials("admin1", "".toCharArray()), "production");
>>> try {
>>> session.getRootNode().addNode("example");
>>> session.save();
>>>
>>> session.getWorkspace().createWorkspace("staging", "production");
>>> } finally {
>>> session.logout();
>>> }
>>> }
>>> }
>>>
>>> Gives an exception with a root cause of:
>>> Caused by: javax.jcr.PathNotFoundException: /example
>>> at org.apache.jackrabbit.core.BatchedItemOperations.getNodeState(BatchedItemOperations.java:1456)
>>> at org.apache.jackrabbit.core.BatchedItemOperations.copy(BatchedItemOperations.java:387)
>>> at org.apache.jackrabbit.core.WorkspaceImpl.internalCopy(WorkspaceImpl.java:404)
>>> at org.apache.jackrabbit.core.WorkspaceImpl.clone(WorkspaceImpl.java:606)
>>> at org.apache.jackrabbit.core.WorkspaceImpl.createWorkspace(WorkspaceImpl.java:221)
>>> at au.projectx.jcr.JcrStartupSingleton.setupWorkspaces(JcrStartupSingleton.java:49)
>>>
>>> Where line 49 is:
>>> session.getWorkspace().createWorkspace("staging", "production");
>>
>> Hmm, looks like a bug. Could you report it on Jira? See
>> http://jackrabbit.apache.org/issue-tracker.html
>>
>> As a workaround, it might work if you use a freshly created session
>> for the createWorkspace() method:
>>
>> Session session = repository.login(...);
>> session.getWorkspace().createWorkspace("staging", "production");
>>
>> Regards,
>> Alex
>>
>> --
>> Alexander Klimetschek
>> alexander.klimetschek@day.com
>
Re: createWorkspace throws PathNotFoundException
Posted by Cory Prowse <co...@prowse.com>.
Attempting to use a fresh session still causes the exception.
I've created issue JCR-2701:
https://issues.apache.org/jira/browse/JCR-2701
Key: JCR-2701
Type: Bug
Status: Open
Priority: Major
Assignee: Unassigned
Component/s: jackrabbit-core
Affects Version/s: 2.1.0
Fix Version/s: None
Environment: Jackrabbit is deployed using released JCA on Glassfish 3.0.1
-- Cory
On 06/08/2010, at 2:19 AM, Alexander Klimetschek wrote:
> On Thu, Aug 5, 2010 at 13:57, Cory Prowse <co...@prowse.com> wrote:
>> Sorry, I should have given a full example of the problem code.
>> The following code fails on a fresh setup.
>>
>> @Startup
>> @Singleton
>> public class JcrStartupSingleton {
>>
>> @Resource(name = "jcr/repository", type = javax.jcr.Repository.class)
>> private Repository repository;
>>
>> @PostConstruct
>> public void setupWorkspaces() throws RepositoryException {
>> final Session session = repository.login(new SimpleCredentials("admin1", "".toCharArray()), "production");
>> try {
>> session.getRootNode().addNode("example");
>> session.save();
>>
>> session.getWorkspace().createWorkspace("staging", "production");
>> } finally {
>> session.logout();
>> }
>> }
>> }
>>
>> Gives an exception with a root cause of:
>> Caused by: javax.jcr.PathNotFoundException: /example
>> at org.apache.jackrabbit.core.BatchedItemOperations.getNodeState(BatchedItemOperations.java:1456)
>> at org.apache.jackrabbit.core.BatchedItemOperations.copy(BatchedItemOperations.java:387)
>> at org.apache.jackrabbit.core.WorkspaceImpl.internalCopy(WorkspaceImpl.java:404)
>> at org.apache.jackrabbit.core.WorkspaceImpl.clone(WorkspaceImpl.java:606)
>> at org.apache.jackrabbit.core.WorkspaceImpl.createWorkspace(WorkspaceImpl.java:221)
>> at au.projectx.jcr.JcrStartupSingleton.setupWorkspaces(JcrStartupSingleton.java:49)
>>
>> Where line 49 is:
>> session.getWorkspace().createWorkspace("staging", "production");
>
> Hmm, looks like a bug. Could you report it on Jira? See
> http://jackrabbit.apache.org/issue-tracker.html
>
> As a workaround, it might work if you use a freshly created session
> for the createWorkspace() method:
>
> Session session = repository.login(...);
> session.getWorkspace().createWorkspace("staging", "production");
>
> Regards,
> Alex
>
> --
> Alexander Klimetschek
> alexander.klimetschek@day.com
Re: createWorkspace throws PathNotFoundException
Posted by Alexander Klimetschek <ak...@day.com>.
On Thu, Aug 5, 2010 at 13:57, Cory Prowse <co...@prowse.com> wrote:
> Sorry, I should have given a full example of the problem code.
> The following code fails on a fresh setup.
>
> @Startup
> @Singleton
> public class JcrStartupSingleton {
>
> @Resource(name = "jcr/repository", type = javax.jcr.Repository.class)
> private Repository repository;
>
> @PostConstruct
> public void setupWorkspaces() throws RepositoryException {
> final Session session = repository.login(new SimpleCredentials("admin1", "".toCharArray()), "production");
> try {
> session.getRootNode().addNode("example");
> session.save();
>
> session.getWorkspace().createWorkspace("staging", "production");
> } finally {
> session.logout();
> }
> }
> }
>
> Gives an exception with a root cause of:
> Caused by: javax.jcr.PathNotFoundException: /example
> at org.apache.jackrabbit.core.BatchedItemOperations.getNodeState(BatchedItemOperations.java:1456)
> at org.apache.jackrabbit.core.BatchedItemOperations.copy(BatchedItemOperations.java:387)
> at org.apache.jackrabbit.core.WorkspaceImpl.internalCopy(WorkspaceImpl.java:404)
> at org.apache.jackrabbit.core.WorkspaceImpl.clone(WorkspaceImpl.java:606)
> at org.apache.jackrabbit.core.WorkspaceImpl.createWorkspace(WorkspaceImpl.java:221)
> at au.projectx.jcr.JcrStartupSingleton.setupWorkspaces(JcrStartupSingleton.java:49)
>
> Where line 49 is:
> session.getWorkspace().createWorkspace("staging", "production");
Hmm, looks like a bug. Could you report it on Jira? See
http://jackrabbit.apache.org/issue-tracker.html
As a workaround, it might work if you use a freshly created session
for the createWorkspace() method:
Session session = repository.login(...);
session.getWorkspace().createWorkspace("staging", "production");
Regards,
Alex
--
Alexander Klimetschek
alexander.klimetschek@day.com
Re: createWorkspace throws PathNotFoundException
Posted by Cory Prowse <co...@prowse.com>.
Sorry, I should have given a full example of the problem code.
The following code fails on a fresh setup.
@Startup
@Singleton
public class JcrStartupSingleton {
@Resource(name = "jcr/repository", type = javax.jcr.Repository.class)
private Repository repository;
@PostConstruct
public void setupWorkspaces() throws RepositoryException {
final Session session = repository.login(new SimpleCredentials("admin1", "".toCharArray()), "production");
try {
session.getRootNode().addNode("example");
session.save();
session.getWorkspace().createWorkspace("staging", "production");
} finally {
session.logout();
}
}
}
Gives an exception with a root cause of:
Caused by: javax.jcr.PathNotFoundException: /example
at org.apache.jackrabbit.core.BatchedItemOperations.getNodeState(BatchedItemOperations.java:1456)
at org.apache.jackrabbit.core.BatchedItemOperations.copy(BatchedItemOperations.java:387)
at org.apache.jackrabbit.core.WorkspaceImpl.internalCopy(WorkspaceImpl.java:404)
at org.apache.jackrabbit.core.WorkspaceImpl.clone(WorkspaceImpl.java:606)
at org.apache.jackrabbit.core.WorkspaceImpl.createWorkspace(WorkspaceImpl.java:221)
at au.projectx.jcr.JcrStartupSingleton.setupWorkspaces(JcrStartupSingleton.java:49)
Where line 49 is:
session.getWorkspace().createWorkspace("staging", "production");
-- Cory
On 05/08/2010, at 9:29 PM, Alexander Klimetschek wrote:
> On Thu, Aug 5, 2010 at 10:41, Cory Prowse <co...@prowse.com> wrote:
>> Hi,
>>
>> I'm attempting to create a workspace from another srcWorkspace but it is throwing a PathNotFoundException on a node that is a child of the root.
>>
>> This is on JackRabbit 2.1.0 deployed as a JCA.
>>
>> I am essentially doing the following:
>>
>> session = repository.login(new SimpleCredentials("admin1", "".toCharArray()), "default");
>> session.getRootNode().addNode("/example", NodeType.NT_UNSTRUCTURED);
>> session.save();
>> workspace.createWorkspace("staging", "default");
>> session.logout();
>>
>> This throws a PathNotFoundException on "/example".
>>
>> Not sure what to do from here, can anyone provide possible causes?
>
> I guess if you look close, the exception is not thrown by
> createWorkspace but by the previous addNode() (or save()) operation.
> addNode() expects a relative path, so it should be:
>
> session.getRootNode().addNode("example", NodeType.NT_UNSTRUCTURED);
>
> Regards,
> Alex
>
> --
> Alexander Klimetschek
> alexander.klimetschek@day.com
Re: createWorkspace throws PathNotFoundException
Posted by Alexander Klimetschek <ak...@day.com>.
On Thu, Aug 5, 2010 at 10:41, Cory Prowse <co...@prowse.com> wrote:
> Hi,
>
> I'm attempting to create a workspace from another srcWorkspace but it is throwing a PathNotFoundException on a node that is a child of the root.
>
> This is on JackRabbit 2.1.0 deployed as a JCA.
>
> I am essentially doing the following:
>
> session = repository.login(new SimpleCredentials("admin1", "".toCharArray()), "default");
> session.getRootNode().addNode("/example", NodeType.NT_UNSTRUCTURED);
> session.save();
> workspace.createWorkspace("staging", "default");
> session.logout();
>
> This throws a PathNotFoundException on "/example".
>
> Not sure what to do from here, can anyone provide possible causes?
I guess if you look close, the exception is not thrown by
createWorkspace but by the previous addNode() (or save()) operation.
addNode() expects a relative path, so it should be:
session.getRootNode().addNode("example", NodeType.NT_UNSTRUCTURED);
Regards,
Alex
--
Alexander Klimetschek
alexander.klimetschek@day.com