On Wed, May 6, 2009 at 1:27 PM, astra123 <[email protected]> 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, > true); > 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 snippet): http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/RepositoryStartupServlet.java?view=markup 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 ;-) Regards, Alex -- Alexander Klimetschek [email protected]
