Repository Server HOWTO

This document describes how to use a Jackrabbit content repository in the deployment model 3: The Repository Server. In this deployment model, a separate repository server is running outside the virtual machine the client application is running in. A repository server can serve multiple applications running on separate JVMs on separate network hosts. See the JCR client application HOWTO for instructions on how to use the configured content repository server.

Note that JCR specification defines no standard communication protocol for inter-JVM repository access, and that Jackrabbit supports no such protocol by default. However, Jackrabbit contains tools for using JCR content repositories over the RMI and WebDAV protocols (see the jcr-rmi and the jcr-server, webapp packages).

This how-to contains instructions for accessing a JCR-RMI server in Tomcat versions 4.x and 5.x. It should be easy to modify the instructions for other container environments and communication protocols.

In addition to the following the instructions in this document, you also need to have an already running JCR-RMI server. See the JCR-RMI javadocs for instructions on how to setup such a server.

Warning: The current JCR-RMI library is designed for simplicity, not performance. You will probably experience major performance issues if you try running any non-trivial applications on top of JCR-RMI.

Tomcat instructions

Follow the steps below to setup a model 3 JCR-RMI client deployment for your web application in Tomcat 4.x or 5.x. Example code for both versions of Tomcat is included after this overview.

Note that these instructions closely follow the Model 1 HOWTO instructions. By making similar changes (change the factory class and parameters of the repository) to the Model 2 HOWTO instructions, you can setup a shared JCR-RMI client deployment for all applications in the container.

  1. Place the JCR-RMI jar file and its dependencies (including the JCR API jar) under Tomcat folder/webapps/your app/WEB-INF/lib.
  2. Register the JCR-RMI client repository factory in the context scope.

Step 2 - Context configuration

In Tomcat 4.x and 5.0, add the following snippet in server.xml under the Context element of your web application.

<Resource name="jcr/repository"

<ResourceParams name="jcr/repository">
    <value>[The RMI URL of the repository]</value>

In Tomcat 5.5, add the following snippet in your application's context.xml file (or in the server.xml file if you prefer central configuration).

<Resource name="jcr/repository"
          url="[The RMI URL of the repository]"/>