jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: Getting the error while trying to access the repository thru jcr-RMI concept
Date Wed, 06 May 2009 12:01:55 GMT
On Wed, May 6, 2009 at 1:27 PM, astra123 <sandhya.jayachandran@tcs.com> wrote:
> The code which i used to register my repository with RMI is :
>           String configFile = "repository.xml";
>            String repHomeDir = "repository";
>            Hashtable env = new Hashtable();
>            env.put(Context.INITIAL_CONTEXT_FACTORY,
> "org.apache.jackrabbit.core.jndi" + ".provider.DummyInitialContextFactory");
>            env.put(Context.PROVIDER_URL, "localhost");
>            InitialContext ctx = new InitialContext(env);
>            RegistryHelper.registerRepository(ctx,
>                                                 "repo",
>                                                   configFile,
>                                                     repHomeDir,
>            Repository r = (Repository) ctx.lookup("repo");
>            String name="rmi://localhost:8084/repo";
>            RemoteAdapterFactory factory = new ServerAdapterFactory();
>            RemoteRepository remote = factory.getRemoteRepository(r);
>            //making RMI binding
>            Naming.bind(name, remote);

You need to start the RMI server under port 8084. The name would then
only be "repo" AFAIK. Starting RMI is covered on the web. Here is the
code of the Jackrabbit webapp doing this, see method "registerRMI"
(but note that it covers many cases and might not be the simplest code


To avoid having to write that code, you could run
jackrabbit-standalone, which integrates the Jetty servlet container
and starts the Jackrabbit repo + the Jackrabbit webapp with a simple
double-click (of the jar). Or you could put the webapp in your
favorite servlet container. But this only makes sense if you want to
run Jackrabbit in a webapp context ;-)


Alexander Klimetschek

View raw message