Page tree
Skip to end of metadata
Go to start of metadata

What's this about?

This page describes a sample configuration for Jackrabbit in Magnolia that uses the h2 embedded database engine.

Why would you want this? h2 is an alternative to the embedded Derby database used by default in Jackrabbit, and has the following advantages:

  • it uses only a few files to store the entire db, unlike Derby which will create (and keep open) thousands of files
  • faster (possibly, the h2 developer claims it is, but I haven't tested myself)

In particular the first advantage is a solution to the "too many open files" problem many people have running magnolia under linux.

Get the JDBC driver

Download from: (get the JAR file)

Maven dependency:


Put the JAR in magnolia's WEB-INF/lib folder or in your tomcat's lib folder.

Sample Jackrabbit configuration

Here's the sample. Put it in your repo-conf folder and point to it from


Sample jackrabbit-bundle-h2-search.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 2.0//EN" "">
  <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
    <param name="path" value="${rep.home}/repository" />
  <Security appName="magnolia">
    <SecurityManager class="org.apache.jackrabbit.core.DefaultSecurityManager"/>
    <AccessManager class="">
    <LoginModule class="info.magnolia.jaas.sp.jcr.JackrabbitAuthenticationModule">
  <DataStore class="">
    <param name="path" value="${rep.home}/repository/datastore"/>
    <param name="minRecordLength" value="1024"/>
  <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default" />
  <Workspace name="default">
    <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
      <param name="path" value="${wsp.home}/default" />
    <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.H2PersistenceManager">
      <param name="url" value="jdbc:h2:${wsp.home}/db" />
      <param name="schemaObjectPrefix" value="pm_${}_" />
    <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
      <param name="path" value="${wsp.home}/index" />
      <param name="useCompoundFile" value="true" />
      <param name="minMergeDocs" value="100" />
      <param name="volatileIdleTime" value="3" />
      <param name="maxMergeDocs" value="100000" />
      <param name="mergeFactor" value="10" />
      <param name="maxFieldLength" value="10000" />
      <param name="bufferSize" value="10" />
      <param name="cacheSize" value="1000" />
      <param name="forceConsistencyCheck" value="false" />
      <param name="autoRepair" value="true" />
      <param name="queryClass" value="org.apache.jackrabbit.core.query.QueryImpl" />
      <param name="resultFetchSize" value="100" />
      <param name="extractorPoolSize" value="3" />
      <param name="extractorTimeout" value="100" />
      <param name="extractorBackLogSize" value="100" />
      <AccessControlProvider class="info.magnolia.cms.core.MagnoliaAccessProvider" />
  <Versioning rootPath="${rep.home}/version">
    <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
      <param name="path" value="${rep.home}/workspaces/version" />
    <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.H2PersistenceManager">
      <param name="url" value="jdbc:h2:${rep.home}/version/db" />
      <param name="schemaObjectPrefix" value="version_" />


  1. I am now using this configuration on our Magnolia 5.3 project to develop locally and it seems to run fine. Have not noticed major improvements in speed compared to Derby however, but also have really not tested this. 

    We use H2 version 1.4.182 by the way.

  2. I use H2 for small to mid-size projects since more than a year and i'm very happy with it. Way less open files than derby and still everything directly on the filesystem. nice to backup.

    i use currently



  3. Guess we could bundle the repo xml as well (like we do for a bunch of others). Right now the one on this page is a bit out-of-sync with our default config (search excepts for example). Good stuff nonetheless. (wink)

  4. I've outlined all the JR config options at this page Jackrabbit Repository Configuration File. It also includes H2.

    1. Great, you still need to come up with the jdbc url manually, right? I still think it's gonna be a tad easier if we give it away (especially if we already provide others—but yeah ideally, building your repo config is more of a mix-and-match than ready-to-go).

      MGNLCE-48 - Getting issue details... STATUS  is there anyhow, let's see where it ends...

      1. Yes, maybe I could add a section on embedded DBs.

        I totally agree that we should provide the files. I was thinking if we are already in there, maybe we could update the current files as well. A lot of the settings and classes have become deprecated due to changes in JR and Lucene.