Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2212

Restarting a repository with generated namespace prefixes fails

    Details

      Description

      I have a Modeshape repository containing properties that use namespaces registered using the method NamespaceRegistry#registerNamespace( String uri ). These properties work as expected, but after a restart the namespace prefixes fail to initialize correctly.

      Caused by: 
      org.modeshape.jcr.value.NamespaceException: There is no namespace registered for the prefix "ns005"
      	at org.modeshape.jcr.value.basic.NameValueFactory.create(NameValueFactory.java:134)
      	at org.modeshape.jcr.value.basic.NameValueFactory.create(NameValueFactory.java:56)
      	at org.modeshape.jcr.cache.document.DocumentTranslator.childReferenceFrom(DocumentTranslator.java:991)
      	at org.modeshape.jcr.cache.document.DocumentTranslator.childReferencesListFromArray(DocumentTranslator.java:936)
      	at org.modeshape.jcr.cache.document.DocumentTranslator.getChildReferences(DocumentTranslator.java:887)
      	at org.modeshape.jcr.cache.document.LazyCachedNode.getChildReferences(LazyCachedNode.java:418)
      	at org.modeshape.jcr.cache.document.SessionNode.getChildReferences(SessionNode.java:993)
      	at org.modeshape.jcr.SystemContent.store(SystemContent.java:278)
      	at org.modeshape.jcr.SystemContent.store(SystemContent.java:255)
      	at org.modeshape.jcr.RepositoryNodeTypeManager.registerNodeTypes(RepositoryNodeTypeManager.java:515)
      	at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:1129)
      	at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:971)
      	at org.modeshape.jcr.JcrRepository.doStart(JcrRepository.java:404)
      	at org.modeshape.jcr.JcrRepository.start(JcrRepository.java:328)
      	at org.modeshape.jcr.JcrRepositoriesContainer$FileRepositoryLookup.repository(JcrRepositoriesContainer.java:232)
      	at org.modeshape.jcr.JcrRepositoriesContainer.getRepository(JcrRepositoriesContainer.java:98)
      	at org.modeshape.jcr.JcrRepositoryFactory.getRepository(JcrRepositoryFactory.java:131)
      

      I took a look in the namespaces data, and all of the generated namespace nodes have the name "ns" (and, presumably, are getting loaded without the digit suffix?)

      Stepping through the initialization in the debugger, it looks like:

      int index = segment.getIndex();
      

      on this line:
      https://github.com/ModeShape/modeshape/blob/master/modeshape-jcr/src/main/java/org/modeshape/jcr/SystemContent.java#L905

      is always returning 1.

      Here's where the generated namespace nodes are created:
      https://github.com/ModeShape/modeshape/blob/master/modeshape-jcr/src/main/java/org/modeshape/jcr/SystemContent.java#L986

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                rhauch Randall Hauch
                Reporter:
                cbeer Chris Beer
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: