How to fix inconsistency in Jackrabbit JCR (BundleFsPersistenceManager)

798 views Asked by At

We are using JackRabbit in production. Unfortunately we have some inconsistencies in the repositories which make the data not unreadable:

ERROR ResourceServiceImpl - RepositoryException to JCR javax.jcr.PathNotFoundException: 1661b5c

The spring bean configuration looks like this:

  <bean id="repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown">
    <constructor-arg index="0" ref="config" />
  </bean>
  <bean id="config" class="org.apache.jackrabbit.core.config.RepositoryConfig" factory-method="create">
    <constructor-arg index="0" ref="jcrXml"/>
    <constructor-arg index="1" value="${instance.repository}" />
  </bean>

  <bean id="jcrXml" class="com.example.misc.InputStreamBeanFactory" factory-method="createStream">
    <constructor-arg value="/jackrabbit-repository.xml" />
  </bean>
  <bean name="jcrSession" factory-bean="repository" factory-method="login" scope="session" destroy-method="logout" />   

The workspaces.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?><Workspace name="default">
    <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
        <param name="path" value="${wsp.home}"/>
    </FileSystem>
    <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.BundleFsPersistenceManager"/>
</Workspace>

From what I've learned (too late) here, the above configured BundleFsPersistenceManager can become inconsistent. It is also writen here that this should NOT be used into production. Well, it is now in production and no one has noticed this before and we would like to exchange this. However first we have to migrate the data and for this reason we need to fix it.

My question: Is there a way to fix this or are these data lost for good?

My second question: What can we do to avoid these issues in the future?.

1

There are 1 answers

0
kevinjansz On BEST ANSWER

There's some notes about additional check.. params that can be set on persistence managers on Adobe CQ - Repository Inconsistency (uses Jackrabbit). The Magnolia - JCR Troubles has a script example for searching for and removing broken nodes. I've seen an approach that combined the logic from this script (written in java) and the checking params allow for a repository to be brought back up and running long enough to get the content out.

To avoid the issues in future - where you want a standalone setup that doesn't use a RDBMS - I'd suggest org.apache.jackrabbit.core.persistence.pool.DerbyPersistenceManager.

    <PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.DerbyPersistenceManager">
      <param name="url" value="jdbc:derby:${wsp.home}/db;create=true"/>
      <param name="schemaObjectPrefix" value="${wsp.name}_"/>
    </PersistenceManager>