The image below is a good picture of where spi2dav fits in. It was taken from the jackrabbit-spi link below.

I could not find much documentation on getting it setup. Here is what I've found so far:

Warning: this is only partially working for me, so there might be errors in the documentation.

Get jcr-server running


To use spi2dav you need to have the "jcr server component" running.


Automated Script

This is a bash script for installing it into jetty. If you want to use it for tomcat you should change the lib/ext to common/endorsed Here is what it does:

# start in the toplevel jetty folder
curl > lib/ext/jcr-1.0.jar
curl -O
mkdir webapps/jackrabbit-1.5
cd webapps/jackrabbit-1.5
unzip ../../jackrabbit-webapp-1.5-SNAPSHOT.war
curl | xsltproc - WEB-INF/web.xml > fixed-web.xml
mv fixed-web.xml WEB-INF/web.xml

Access the remote server from a client

get the jars needed

The jars do not seem to be available for download in binary form, so they must be built:

add the dependencies to your maven pom.xml


write the code to access the repository

This code was figured out based on  org.apache.jackrabbit.jcr2spi.JCR2SPIRepositoryStub  located in 

import javax.jcr.Repository;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;

import org.apache.jackrabbit.jcr2spi.RepositoryImpl;
import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig;
import org.apache.jackrabbit.spi.IdFactory;
import org.apache.jackrabbit.spi.NameFactory;
import org.apache.jackrabbit.spi.PathFactory;
import org.apache.jackrabbit.spi.QValueFactory;
import org.apache.jackrabbit.spi.RepositoryService;
import org.apache.jackrabbit.spi.commons.identifier.IdFactoryImpl;
import org.apache.jackrabbit.spi.commons.value.QValueFactoryImpl;
import org.apache.jackrabbit.spi2dav.RepositoryServiceImpl;


  String url = "http://localhost:8080/jackrabbit/server";

  final IdFactory idFactory = IdFactoryImpl.getInstance();
  final NameFactory nFactory = NameFactoryImpl.getInstance();
  final PathFactory pFactory = PathFactoryImpl.getInstance();
  final QValueFactory vFactory = QValueFactoryImpl.getInstance();
  final RepositoryServiceImpl webdavRepoService = 
     new RepositoryServiceImpl(url, idFactory, nFactory, pFactory, vFactory);

  RepositoryConfig config = new RepositoryConfig() {
    public RepositoryService getRepositoryService() {
      return webdavRepoService;

    public String getDefaultWorkspaceName() {
      return "default";

    public CacheBehaviour getCacheBehaviour() {
      return CacheBehaviour.INVALIDATE;

  Repository repository = RepositoryImpl.create(config);
  Session session = repository.login(new SimpleCredentials("user", "password".toCharArray()));

There are 1 attachment(s) stored for this page.

HowtoSpi2Dav (last edited 2009-09-20 23:45:04 by localhost)