You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Alexander Klimetschek <ak...@day.com> on 2009/05/06 14:01:55 UTC

Re: Getting the error while trying to access the repository thru jcr-RMI concept

On Wed, May 6, 2009 at 1:27 PM, astra123 <sa...@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,
>                                                            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
alexander.klimetschek@day.com

Re: Getting the error while trying to access the repository thru jcr-RMI concept

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,

On Thu, May 7, 2009 at 4:28 AM, astra123 <sa...@tcs.com> wrote:
> ...you have told something about the JackRabbit-standalone in your reply.
> Can you please explain that part in detailed manner....

See http://jackrabbit.apache.org/jackrabbit-standalone.html

-Bertrand

Re: Getting the error while trying to access the repository thru jcr-RMI concept

Posted by astra123 <sa...@tcs.com>.
Hi,

Thanks for your response.

you have told something about the JackRabbit-standalone in your reply.
Can you please explain that part in detailed manner.

Because im new to jackrabbit and cant get you clearly.

Thanks,



Alexander Klimetschek wrote:
> 
> On Wed, May 6, 2009 at 1:27 PM, astra123 <sa...@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,
>>                                                            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
> alexander.klimetschek@day.com
> 
> 

-- 
View this message in context: http://www.nabble.com/Getting-the-error-while-trying-to-access-the-repository-thru-jcr-RMI-concept-tp23404753p23419165.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.