From users-return-17807-apmail-jackrabbit-users-archive=jackrabbit.apache.org@jackrabbit.apache.org Mon Aug 1 17:15:48 2011 Return-Path: X-Original-To: apmail-jackrabbit-users-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 664BB7D1F for ; Mon, 1 Aug 2011 17:15:48 +0000 (UTC) Received: (qmail 80609 invoked by uid 500); 1 Aug 2011 17:15:47 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 80476 invoked by uid 500); 1 Aug 2011 17:15: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 80466 invoked by uid 99); 1 Aug 2011 17:15:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Aug 2011 17:15:46 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [208.64.63.171] (HELO mail.sptci.com) (208.64.63.171) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Aug 2011 17:15:39 +0000 Received: from localhost (localhost [127.0.0.1]) by localhost.sptci.com (Postfix) with ESMTP id 4030C187CB for ; Mon, 1 Aug 2011 10:15:17 -0700 (PDT) X-Virus-Scanned: amavisd-new at sptci.com Received: from mail.sptci.com ([127.0.0.1]) by localhost (mail.sptci.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id EKYN07EyeWFz for ; Mon, 1 Aug 2011 10:15:16 -0700 (PDT) Received: from press-dhcp-204071.uchicago.edu (press-dhcp-204071.uchicago.edu [128.135.204.71]) by mail.sptci.com (Postfix) with ESMTPSA id BC588187CA for ; Mon, 1 Aug 2011 10:15:15 -0700 (PDT) From: Rakesh Vidyadharan Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: multipart/alternative; boundary=Apple-Mail-10-1051749260 Subject: Re: Obtaining the running repository through JNDI Date: Mon, 1 Aug 2011 12:15:14 -0500 In-Reply-To: To: users@jackrabbit.apache.org References: Message-Id: X-Mailer: Apple Mail (2.1084) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail-10-1051749260 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 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, >=20 > 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. >=20 > 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. >=20 > I paste here the relevant pieces of code for this issue: > * > Context.xml (Tomcat 7 server)* >=20 > type=3D"javax.jcr.Repository" >=20 > = factory=3D"org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFac= tory" > /> >=20 > Web.xml (Web application) >=20 > > Object Factory for the Repository > repositoryname > = javax.jcr.Repository > >=20 > *bootstrap.properties* >=20 > # Repository configuration settings (will be adjusted by installer) >=20 > repository.config=3D/dev/raizrepositorio/repository.xml > repository.home=3D/dev/raizrepositorio/repository > #repository.name=3Djackrabbit.repository > repository.name=3Drepositoryname >=20 > # RMI Settings > rmi.enabled=3Dtrue > rmi.port=3D0 > rmi.host=3Dlocalhost > # If the URI is not specified, it's composed as follows: > #rmi.uri=3D//${rmi.host}:${rmi.port}/${repository.name} >=20 > # JNDI Settings > # all properties starting with 'java.naming.' will go into the > # environment of the initial context > jndi.enabled=3Dtrue > # if the name is not specified, it's initialized with the = repository.name > #jndi.name=3D${repository.name} > jndi.name=3Drepositoryname > java.naming.provider.url=3Djnp://localhost:1099 > = java.naming.factory.initial=3Dorg.apache.jackrabbit.core.jndi.provider.Dum= myInitialContextFactory >=20 >=20 > *Plain Java class trying to obtain the Repository object through JNDI* >=20 > Hashtable env =3D new Hashtable(); > env.put(Context.PROVIDER_URL, "jnp://localhost:1099"); > env.put(Context.INITIAL_CONTEXT_FACTORY, > = "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory"); >=20 > Context initCtx =3D new InitialContext(env); > Context envCtx =3D (Context) initCtx.lookup("java:comp/env"); > Repository repo =3D (Repository) = envCtx.lookup("repositoryname"); >=20 >=20 > Any clue on how to detect what is going wrong (object not registered = in JNDI > directory, object not correctly requested, initial misconfigured > context...). >=20 > 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? >=20 >=20 > Thanks in advance for your attention! >=20 >=20 > 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 --Apple-Mail-10-1051749260--