Index: src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java (revision 808909) +++ src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java (working copy) @@ -145,12 +145,12 @@ public static final NodeId VERSION_STORAGE_NODE_ID = NodeId.valueOf("deadbeef-face-babe-cafe-babecafebabe"); /** - * hardcoded id of the "/jcr:system/jcr:versionStorage/jcr:activities" node + * hardcoded id of the "/jcr:system/jcr:activities" node */ public static final NodeId ACTIVITIES_NODE_ID = NodeId.valueOf("deadbeef-face-babe-ac71-babecafebabe"); /** - * hardcoded id of the "/jcr:system/jcr:versionStorage/jcr:configurations" node + * hardcoded id of the "/jcr:system/jcr:configurations" node */ public static final NodeId CONFIGURATIONS_NODE_ID = NodeId.valueOf("deadbeef-face-babe-c04f-babecafebabe"); Index: src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java (revision 808909) +++ src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java (working copy) @@ -202,6 +202,7 @@ if (!hasNonVirtualItemState(rootNodeId)) { createRootNodeState(rootNodeId, ntReg); } + ensureActivitiesNode(); } /** @@ -1315,6 +1316,28 @@ } /** + * Makes sure child node entry for mandatory jcr:activities exist. + * Repositories upgraded from 1.x do not have it. + *

+ * This method assumes that the jcr:system node already exists. + * + * @throws ItemStateException if an error occurs while reading or writing to + * the persistence manager. + */ + private void ensureActivitiesNode() throws ItemStateException { + NodeState jcrSystemState = (NodeState) getNonVirtualItemState(RepositoryImpl.SYSTEM_ROOT_NODE_ID); + if (!jcrSystemState.hasChildNodeEntry(RepositoryImpl.ACTIVITIES_NODE_ID)) { + jcrSystemState.addChildNodeEntry(NameConstants.JCR_ACTIVITIES, RepositoryImpl.ACTIVITIES_NODE_ID); + + ChangeLog changeLog = new ChangeLog(); + changeLog.modified(jcrSystemState); + + persistMgr.store(changeLog); + changeLog.persisted(); + } + } + + /** * Returns the item state for the given id without considering virtual * item state providers. */