How to access remote jackrabbit repository?

Abhishek Dhote picture Abhishek Dhote · May 2, 2011 · Viewed 10.5k times · Source

I need to work with remote jackrabbit repository. I use following code to connect to the local repository:

Repository repository = new TransientRepository();
Session session = repository.login(new SimpleCredentials("username", "password".toCharArray()));

and this works for the local repository but what do I do incase of the remote jackrabbit?

Answer

abahgat picture abahgat · May 2, 2011

Have you tried using this?

import javax.jcr.Repository;
import org.apache.jackrabbit.commons.JcrUtils;

Repository repository = JcrUtils.getRepository("http://$SERVER_ADDRESS:$PORT/$CONTEXT");

That should work if the remote repository is exposing RMI services. Please note that RMI access is in general considered to be quite slow.

You'll find more info about accessing remote repositories here.