jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francisco Carriedo Scher <fcarrie...@gmail.com>
Subject Re: Obtaining the running repository through JNDI
Date Mon, 01 Aug 2011 22:29:22 GMT
Thank you very much Rakesh, just one doubt: do you mean with global
configuration that the instance of the JNDI-retrieved object will be
Tomcat-wide available or even outside Tomcat (let's say "World-wide"
available).

I am assuming that the repository instance will be that unique and already
up, not a brand new instance (what would result useless for my purposes).

Thanks a lot again for your response!

2011/8/1 Rakesh Vidyadharan <rakesh@sptci.com>

> If I am not mistaken, configuring via context.xml will only make the
> resource available to that web app context.  If you want a global
> configuration, you will need to add to Tomcat server.xml under
> GlobalNamingResources and add ResourceLink in your context.xml file.
>
> On 1 Aug 2011, at 11:39 AM, Francisco Carriedo Scher wrote:
>
> > Hi there,
> >
> > i have a JR repository up and running and now i want to obtain the
> (already
> > running) repository instance through JNDI to use it through simple Java
> > classes in other projects. By default the repository is available through
> > JNDI only locally to the webapp, which is not enough for my case.
> >
> > Now, i followed the instructions to turn it globally available (even
> simple
> > Java applications running out of the Tomcat 7 server i am using) without
> > success. Note that I followed the Tomcat 7 instructions to enable JNDI
> > resources aswell.
> >
> > I paste here the relevant pieces of code for this issue:
> > *
> > Context.xml (Tomcat 7 server)*
> >
> >     <Resource name="repositoryname" auth="Container"
> >            type="javax.jcr.Repository"
> >
> >
> factory="org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory"
> > />
> >
> > Web.xml (Web application)
> >
> >    <resource-env-ref>
> >        <description>Object Factory for the Repository</description>
> >        <resource-env-ref-name>repositoryname</resource-env-ref-name>
> >
>  <resource-env-ref-type>javax.jcr.Repository</resource-env-ref-type>
> >    </resource-env-ref>
> >
> > *bootstrap.properties*
> >
> > # Repository configuration settings (will be adjusted by installer)
> >
> > repository.config=/dev/raizrepositorio/repository.xml
> > repository.home=/dev/raizrepositorio/repository
> > #repository.name=jackrabbit.repository
> > repository.name=repositoryname
> >
> > # RMI Settings
> > rmi.enabled=true
> > rmi.port=0
> > rmi.host=localhost
> > # If the URI is not specified, it's composed as follows:
> > #rmi.uri=//${rmi.host}:${rmi.port}/${repository.name}
> >
> > # JNDI Settings
> > # all properties starting with 'java.naming.' will go into the
> > # environment of the initial context
> > jndi.enabled=true
> > # if the name is not specified, it's initialized with the
> repository.name
> > #jndi.name=${repository.name}
> > jndi.name=repositoryname
> > java.naming.provider.url=jnp://localhost:1099
> >
> java.naming.factory.initial=org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory
> >
> >
> > *Plain Java class trying to obtain the Repository object through JNDI*
> >
> > Hashtable env = new Hashtable();
> >        env.put(Context.PROVIDER_URL, "jnp://localhost:1099");
> >        env.put(Context.INITIAL_CONTEXT_FACTORY,
> > "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory");
> >
> >        Context initCtx = new InitialContext(env);
> >        Context envCtx = (Context) initCtx.lookup("java:comp/env");
> >        Repository repo = (Repository) envCtx.lookup("repositoryname");
> >
> >
> > Any clue on how to detect what is going wrong (object not registered in
> JNDI
> > directory, object not correctly requested, initial misconfigured
> > context...).
> >
> > By the way, i assume that the retrieved object will be the initialized
> > instance created as the JR webapp is fired up, isn't it?
> >
> >
> > Thanks in advance for your attention!
> >
> >
> > P.S.: for those who paid attention to my previous emails to this list:
> the
> > answer is comming, it is not trivial to write, so it will still take a
> > little bit, but will come because i find my case helpfull for other
> newbies.
> > I thank you all once more!
>
> Rakesh Vidyadharan
> President & CEO
> Sans Pareil Technologies, Inc.
> http://www.sptci.com/
>
>
> | 400 N McClurg Ct, Suite 1411 | Chicago, IL 60611-4339 USA |
> | Ph: +1 (312) 212-3933 | Fax: +1 (312) 276-4410 | E-mail:
> rakesh@sptci.com
>
>
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message