jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kbar <whereisk...@gmail.com>
Subject JNDI and Jackrabbit
Date Sun, 23 Aug 2009 09:47:36 GMT

Can someone tell me if the following is actually possible, and if it is then
perhaps someone could point me to some code that explains how to do it, if
possible in really simple baby steps. Assume i have next to no knowledge of
tomcat or developing in the java platform at all (the reason being I am new
to this but have over 15 years of development experience and can usually
pick up this stuff very quickly with a few sample files, but it seems
jackrabbit is ever evolving and there is simply not enough sample projects
for people like myself to look at).

I have jackrabbit setup and running. I can access it via
http://localhost:8080/jackrabbit,  so far so good.

Now I have another application written in java on the same machine that
jackrabbit is running on. I would like to talk to jackrabbit from that
machine. I believe this is possible using JNDI. Is this possible? 

There is sample code on the jackrabbit site that states the following...

========================
import javax.jcr.Repository;
import javax.naming.Context;
import javax.naming.InitialContext;

Context context = new InitialContext(...);
Repository repository = (Repository) context.lookup(...);
========================

What goes in the place of the "..."?

I tried the following...

 InitialContext ctx = new InitialContext() ;
 Context environment = (Context) ctx.lookup("java:comp/env");
 Repository repo = (Repository) environment.lookup("jackrabbit.repository");

And also this...

   InitialContext ctx = new InitialContext() ;
   Repository repo = (Repository) ctx.lookup("jackrabbit.repository");

No luck there either. The reason I am trying "jackrabbit.repository" is
because in my "Tomcat6/jackrabbit" folder is a file called
"bootstrap.properties" that says the "repository.home=jackrabbit.repository"
and also because in my "Tomcat/webapps/jackrabbit/WEB-INF/web.xml" is the
following...


 <init-param>
            <param-name>repository-name</param-name>
            <param-value>jackrabbit.repository</param-value>
            <description>Repository Name under which the repository is
registered via JNDI/RMI</description>
        </init-param>


Here is my bootstrap.properties file...

java.naming.factory.initial=org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory
repository.home=jackrabbitrepo
rmi.enabled=true
repository.config=jackrabbitrepo/repository.xml
repository.name=jackrabbit.repository
rmi.host=localhost
java.naming.provider.url=http\://www.apache.org/jackrabbit
jndi.enabled=true
rmi.port=0


I hope someone can help me. Its been 8 days of solid crunching around with
Jackrabbit and I know it can do what I want, its just a matter of trying to
keep digging at it with my blunt spoon (or at the moment its more like
trying to break into a bank vault full of nice yummy gold by smashing my
head against the safe door). I will persist though since I think it is great
technology and just needs a bit more documentation.

Cheers,
Kent.


     
-- 
View this message in context: http://www.nabble.com/JNDI-and-Jackrabbit-tp25101779p25101779.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message