jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cory Prowse (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-2701) createWorkspace throws PathNotFoundException
Date Fri, 06 Aug 2010 19:05:19 GMT

    [ https://issues.apache.org/jira/browse/JCR-2701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896125#action_12896125
] 

Cory Prowse commented on JCR-2701:
----------------------------------

Another example showing the same exception when attempting to clone a node after successfully
creating an empty workspace.
(note that the exact same exception is thrown if the createWorkspace method does not provide
a srcWorkspace)

Exception stacktrace follows code.

--
package au.jcr;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;

@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 productionSession = repository.login(new SimpleCredentials("admin",
"".toCharArray()), "production");
        try {
            // Same error occurs even if following line excludes 2nd parameter for srcWorkspace
            productionSession.getWorkspace().createWorkspace("staging", "production");
            productionSession.getRootNode().addNode("example");
            productionSession.save();
        } finally {
            productionSession.logout();
        }

        final Session stagingSession = repository.login(new SimpleCredentials("admin", "".toCharArray()),
"staging");
        try {
            // Exception is thrown here (is line 34)
            stagingSession.getWorkspace().clone("production", "/example", "/example", false);
            stagingSession.save();
        } finally {
            stagingSession.logout();
        }
    }
}
---

javax.ejb.EJBException: javax.ejb.CreateException: Initialization failed for Singleton JcrStartupSingleton
        at com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:698)
...
Caused by: javax.ejb.CreateException: Initialization failed for Singleton JcrStartupSingleton
        at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:528)
...
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 au.jcr.JcrStartupSingleton.setupWorkspaces(JcrStartupSingleton.java:34)

> createWorkspace throws PathNotFoundException
> --------------------------------------------
>
>                 Key: JCR-2701
>                 URL: https://issues.apache.org/jira/browse/JCR-2701
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.1.0
>         Environment: Jackrabbit is deployed using released JCA on Glassfish 3.0.1
>            Reporter: Cory Prowse
>
> The following code throws a PathNotFoundException:
> ---
> package au.jcr;
> import javax.annotation.PostConstruct;
> import javax.annotation.Resource;
> import javax.ejb.Singleton;
> import javax.ejb.Startup;
> import javax.jcr.Repository;
> import javax.jcr.RepositoryException;
> import javax.jcr.Session;
> import javax.jcr.SimpleCredentials;
> @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("admin", "".toCharArray()),
"production");
>         try {
>             session.getRootNode().addNode("example");
>             session.save();
>             // Exception is thrown here (is line 27)
>             session.getWorkspace().createWorkspace("staging", "production");
>         } finally {
>             session.logout();
>         }
>     }
> }
> ---
> javax.ejb.EJBException: javax.ejb.CreateException: Initialization failed for Singleton
JcrStartupSingleton
>         at com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:698)
> ...
> Caused by: javax.ejb.CreateException: Initialization failed for Singleton JcrStartupSingleton
>         at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:528)
> ...
> 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.jcr.JcrStartupSingleton.setupWorkspaces(JcrStartupSingleton.java:27)
> ...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message