jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iapilgrim <iapilg...@gmail.com>
Subject RE: accessing JCR over JNDI
Date Mon, 13 Oct 2008 02:35:47 GMT


I've deployed jcr-explorer in Jboss 4.2. It is a webapp and access JCR
through JNDI. Do you get it as a hingt?

manub wrote:
> 
> I'm using Jboss 4.2, which uses JbossWeb to deploy web applications.
> 
> Anyway, there are some similar thing between Tomcat and JbossWeb and I
> tried the way you suggested me, but I'm getting a naming not bound
> exception on jcr. The webapp I'm trying to modify is written with SEAM and
> the component who initializes the repository is set with @Startup.
> 
> It seems strange that lots of people have no difficulties with it, maybe
> I'm missing something but I really don’t know what.
> 
> 
> -----Original Message-----
> From: Aleksei Lukin [mailto:lukin@stu.cn.ua]
> Sent: venerdì 10 ottobre 2008 14.00
> To: users@jackrabbit.apache.org
> Subject: Re: accessing JCR over JNDI
> 
> Friday 10 October 2008 12:57:28 Blanco Emanuele написав:
> 
> 
> Well, first question is: how do you start JCR?  You need model 2 to be
> able to access JCR from all deployed apps.
> To do so you msut define global JNDI resource  in tomcat's config like
> this:
>   <GlobalNamingResources>
>    ......
>     <!--
>        JackRabbit content repository //
>      -->
>     <Resource configFilePath="/usr/local/jackrabbit-repo/repository.xml"
>              
> factory="org.apache.jackrabbit.core.jndi.BindableRepositoryFactory"
>               name="jcr/globalRepository"
> repHomeDir="/usr/local/jackrabbit-repo"
>               type="javax.jcr.Repository"
>               auth="Container" />
> 
>   </GlobalNamingResources>
> 
> Thus Tomcat must have all libraries of JCR available. The simpliest way 
> is  just to put all of it in ${tomcat_home}/lib
> 
> So tomcat will start JCR whet it starts.
> Next step is configuration of web application. You must put following
> reference to global repo into your context.xml
> 
>  <ResourceLink global="jcr/globalRepository" name="jcr/repository"
> type="javax.jcr.Repository"/>
> 
> After that ytou can obtain JNDI access to JCR with following code:
> 
>         BindableRepository jrepository = null;
> 
>         try {
>             InitialContext context = new InitialContext();
>             Context environment = (Context)
> context.lookup("java:comp/env");
>             jrepository = (BindableRepository)
> environment.lookup("/jcr/repository");
> 
> ...}
>  the best place for this code is
>  public void contextInitialized(ServletContextEvent sce) method  of
> application listener. Then you can bind repository to web application
> context and use in any place of your
> application.
> 
> 
> --
> SY, Alex Lukin
> RIPE NIC HDL: LEXA1-RIPE
> 
> --
> The information transmitted is intended for the person or entity to which
> it is addressed and may contain confidential and/or privileged material.
> Any review, retransmission, dissemination or other use of, or taking of
> any action in reliance upon, this information by persons or entities other
> than the intended recipient is prohibited. If you received this in error,
> please contact the sender and delete the material from any computer.
> 
> 

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


Mime
View raw message