Return-Path: Delivered-To: apmail-jackrabbit-users-archive@locus.apache.org Received: (qmail 3423 invoked from network); 10 Oct 2008 12:01:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Oct 2008 12:01:49 -0000 Received: (qmail 12018 invoked by uid 500); 10 Oct 2008 12:01:48 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 11785 invoked by uid 500); 10 Oct 2008 12:01:47 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 11774 invoked by uid 99); 10 Oct 2008 12:01:47 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Oct 2008 05:01:47 -0700 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=DNS_FROM_SECURITYSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [195.69.76.130] (HELO stalker.stu.cn.ua) (195.69.76.130) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Oct 2008 12:00:44 +0000 Received: from lukin.stu (lukin.stu [192.168.100.254]) by stalker.stu.cn.ua (8.14.1/8.14.2) with ESMTP id m9ABxCwV033571 for ; Fri, 10 Oct 2008 14:59:12 +0300 (EEST) (envelope-from lukin@stu.cn.ua) From: Aleksei Lukin To: users@jackrabbit.apache.org Subject: Re: accessing JCR over JNDI Date: Fri, 10 Oct 2008 14:59:56 +0300 User-Agent: KMail/1.9.10 References: <9889CC1A69BBC549931AF0B0C250EE6512199FE5F8@CED01CMBXS01.replynet.prv> <48EF220D.2050305@corsaire.fr> <9889CC1A69BBC549931AF0B0C250EE6512199FE61E@CED01CMBXS01.replynet.prv> In-Reply-To: <9889CC1A69BBC549931AF0B0C250EE6512199FE61E@CED01CMBXS01.replynet.prv> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200810101459.57435.lukin@stu.cn.ua> X-Virus-Checked: Checked by ClamAV on apache.org =46riday 10 October 2008 12:57:28 Blanco Emanuele =D0=BD=D0=B0=D0=BF=D0=B8= =D1=81=D0=B0=D0=B2: > Still got null using java:jcr/repo. > > I'm now following this link: > http://th1rty7.blogspot.com/2008/08/jackrabbit-on-jboss-with-jndi-rmi.html > but I really wonder why it doesn't work. > > > > > -----Original Message----- > From: C=C3=A9dric Chantepie [mailto:cchantepie@corsaire.fr] > Sent: venerd=C3=AC 10 ottobre 2008 11.36 > To: users@jackrabbit.apache.org > Subject: Re: accessing JCR over JNDI > > Blanco Emanuele a =C3=A9crit : > > With almost the same code in a WAR deployed in the same jboss makes me > > repo null. > > > > I really have no glue about that. > > Try changing your JNDI ref name, maybe java:jcr/local is reserved. > 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: ...... =20 =20 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 refer= ence to global repo into your context.xml After that ytou can obtain JNDI access to JCR with following code: BindableRepository jrepository =3D null; try { InitialContext context =3D new InitialContext(); Context environment =3D (Context) context.lookup("java:comp/env= "); jrepository =3D (BindableRepository) environment.lookup("/jcr/r= epository"); =2E..} the best place for this code is =20 public void contextInitialized(ServletContextEvent sce) method of applica= tion listener. Then you can bind repository to web application context and = use in any place of your=20 application. =2D-=20 SY, Alex Lukin RIPE NIC HDL: LEXA1-RIPE