Uploaded image for project: 'Jackrabbit Content Repository'
  1. Jackrabbit Content Repository
  2. JCR-2701

createWorkspace throws PathNotFoundException

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.1.1
    • Fix Version/s: None
    • Component/s: jackrabbit-jca
    • Labels:
      None
    • Environment:
      Jackrabbit is deployed using released JCA on Glassfish 3.0.1

      Description

      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)
      ...

        Attachments

        1. JCR-2701.zip
          1.86 MB
          Cory Prowse

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              cosmic Cory Prowse
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: