From users-return-11389-apmail-jackrabbit-users-archive=jackrabbit.apache.org@jackrabbit.apache.org Tue May 05 08:40:24 2009 Return-Path: Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: (qmail 29550 invoked from network); 5 May 2009 08:40:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 May 2009 08:40:24 -0000 Received: (qmail 85966 invoked by uid 500); 5 May 2009 08:40:23 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 85952 invoked by uid 500); 5 May 2009 08:40:23 -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 85941 invoked by uid 99); 5 May 2009 08:40:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 May 2009 08:40:23 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 May 2009 08:40:14 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1M1GBt-00074Q-Mw for users@jackrabbit.apache.org; Tue, 05 May 2009 01:39:53 -0700 Message-ID: <23383311.post@talk.nabble.com> Date: Tue, 5 May 2009 01:39:53 -0700 (PDT) From: astra123 To: users@jackrabbit.apache.org Subject: Re: getting exception while trying to register repository with jndi In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Nabble-From: sandhya.jayachandran@tcs.com References: <23380779.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org Hi, Even after changing the code using lookup...getting same error as before. InitialContext ctx =3D new InitialContext(); Context environment =3D (Context) ctx.lookup("java:comp/env"); Repository r =3D (Repository) environment.lookup("jcr/repository"); SimpleCredentials cred =3D new SimpleCredentials("userid", =20 "".toCharArray()); Session session =3D r.login(cred, null); Workspace ws =3D session.getWorkspace(); Node rn =3D session.getRootNode(); //print the root node name System.out.println("Name of the RootNode"+rn.getPrimaryNodeType().getName()); getting error like=20 javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288) at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325) at javax.naming.InitialContext.lookup(InitialContext.java:392) at NewClass1.main(NewClass1.java:53) In web.xml also i have added the tag as given in the=20 http://jackrabbit.apache.org/jcr-client-application-howto.html link What else i need to change to access the repository via jndi. Please help us to resolve. Thanks. Alexander Klimetschek wrote: >=20 > On Tue, May 5, 2009 at 6:20 AM, astra123 > wrote: >> >> Hi, >> >> I have created one Web application project in NetBeans IDE. >> To that lib folder i have added the jackrabbit-standalone-1.5.4.jar file= . >> Then i have created one java file and placed the sample code which is >> given >> in below link. >> >> http://www.ibm.com/developerworks/java/library/j-jcr/ >> >> by running that java file ,im able to add/retrieve contents in >> repository. >> >> Now i need to view the repository nodes using JCR browser. >> For that i have downloaded the WAR file jcr-explorer.war from net. >> Deployed it in tomcat 6 and imported that war project inside NetBeans >> IDE. >> now im able to launch the Login page of it. >> It is asking for JNDI name,username and pwd. >> >> so i tried registering the repository with JNDI by refering the below >> link >> >> http://jackrabbit.apache.org/jcr-client-application-howto.html >> >> To my Web application's (where sample code resides) web.xml and the java >> file i have added the code snippets as given in above link.When i run >> that >> java file. >> >> Im getting below exception: >> >> May 5, 2009 9:39:19 AM NewClass1 main >> SEVERE: null >> javax.naming.NoInitialContextException: Need to specify class name in >> environment or system property, or as an applet parameter, or in an >> application resource file: =C2=A0java.naming.factory.initial >> =C2=A0 =C2=A0 =C2=A0 =C2=A0at >> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0at >> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0at >> javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:3= 25) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0at javax.naming.InitialContext.rebind(Initial= Context.java:408) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0at >> org.apache.jackrabbit.core.jndi.RegistryHelper.registerRepository(Regist= ryHelper.java:77) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0at NewClass1.main(NewClass1.java:41) >=20 > If NewClass1 is your client, you should retrieve the repository from > JNDI there, and not register it (RegistryHelper.registerRepository()). > The lookup code is the one on > http://jackrabbit.apache.org/jcr-client-application-howto.html >=20 > Regards, > Alex >=20 > --=20 > Alexander Klimetschek > alexander.klimetschek@day.com >=20 >=20 --=20 View this message in context: http://www.nabble.com/getting-exception-while= -trying-to-register-repository-with-jndi-tp23380779p23383311.html Sent from the Jackrabbit - Users mailing list archive at Nabble.com.