Return-Path: Delivered-To: apmail-jackrabbit-users-archive@locus.apache.org Received: (qmail 99561 invoked from network); 16 Jun 2008 12:04:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Jun 2008 12:04:42 -0000 Received: (qmail 68422 invoked by uid 500); 16 Jun 2008 12:04:44 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 68402 invoked by uid 500); 16 Jun 2008 12:04:44 -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 68391 invoked by uid 99); 16 Jun 2008 12:04:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jun 2008 05:04:44 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [210.18.57.150] (HELO primemail.knowledgeinfotech.com) (210.18.57.150) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jun 2008 12:03:55 +0000 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: JCR RMI: how to connect to remote repository ? Date: Mon, 16 Jun 2008 17:33:37 +0530 Message-ID: In-Reply-To: <001501c8cf98$2b0c1590$4801a8c0@pessac.v4x.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: JCR RMI: how to connect to remote repository ? Thread-Index: AcjPkEdjXXYJ8KIRRDCf01nl0KscywAAonQgAAV8zaA= References: <001501c8cf98$2b0c1590$4801a8c0@pessac.v4x.com> From: "Anil K. Kotha" To: X-Virus-Checked: Checked by ClamAV on apache.org Hi Frederic, You can connect to the remote repository using the following code. public static void main(String[] args) { // TODO Auto-generated method stub String username =3D "username"; String password =3D "password"; String privider_url =3D "host:1099"; String ctxLookup =3D "jnp://host:1099/jcrServer"; Hashtable env =3D new Hashtable(); env .put(Context.INITIAL_CONTEXT_FACTORY, =09 "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory"); env.put(Context.PROVIDER_URL, privider_url); env .put(Context.URL_PKG_PREFIXES, =09 "org.jboss.naming:org.jnp.interfaces"); InitialContext ctx; try { ctx =3D new InitialContext(env); RemoteRepository remoteRepository =3D (RemoteRepository) ctx .lookup(ctxLookup); Session session =3D null; try { JackrabbitServerAdapterFactory adapterFactory =3D new JackrabbitServerAdapterFactory(); =09 =09 ClientAdapterFactory adapter =3D new ClientAdapterFactory(); Repository repository =3D adapter.getRepository(remoteRepository); =09 session =3D repository.login(new SimpleCredentials(username, =09 password.toCharArray())); =09 }catch (Exception e) { e.printStackTrace(); } }catch (Exception e) { e.printStackTrace(); } =09 } Cheers, Anilk. -----Original Message----- From: Frederic BOY [mailto:frederic.v4x@gmail.com]=20 Sent: Monday, June 16, 2008 3:33 PM To: users@jackrabbit.apache.org Subject: JCR RMI: how to connect to remote repository ? Hi, I have successfully managed to deploy my JCR repository RMI on jnp://localhost:1099/jcrServer (thanks to jackrabbit JCR RMI). Now how can I access it remotely ? I mean I used to call: repository =3D (Repository) ctx.lookup("java:jcr/local"); for standard local jndi lookup. When I try to replace it with: =20 repository =3D (Repository) ctx.lookup("jnp://{remote_ip_address}:1099/jcrServer"); I get a java.lang.ClassCastException: org.apache.jackrabbit.rmi.server.ServerRepository_Stub I guess I'm missing a point. What's the right method ? Thanks guys in advance, Frederic Boy