This document describes how to setup a Jackrabbit content repository in the deployment model 1; The (Web-) Application Bunde. In this deployment model, each application bundle uses its own local content repository that is not visible to other applications. See the JCR client application HOWTO for instructions on how to use the configured content repository.
Note that it is also possible to bypass the JNDI mechanism by including all the Jackrabbit startup and configuration code directly in your application. This approach however makes a strong binding between your application and the underlying repository implementation.
The instructions in this document apply to Tomcat versions 4.x and 5.x. It should be easy to modify the instructions for other container environments.
Important: remember that two Jackrabbit instances should never read from/write to the same physical storage. This setup is not supported and will lead to corrupt data.
Follow the steps below to setup a model 1 Jackrabbit deployment for your web application in Tomcat 4.x or 5.x. Example code for both versions of Tomcat is included after this overview.
[Tomcat folder]/webapps/[your app]/WEB-INF/lib
.
Limitations: the application should not be redeployed during the same JVM process to avoid creating duplicate Jackrabbit instances with the same configuration. In case you want to redeploy your application be sure to shutdown the repository when your application is undeployed. It can be done by calling RepositoryImpl.shutdown() (e.g. in the destroy() method of a servlet).