Return-Path: X-Original-To: apmail-directory-dev-archive@www.apache.org Delivered-To: apmail-directory-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0F67647D6 for ; Mon, 23 May 2011 09:42:54 +0000 (UTC) Received: (qmail 43466 invoked by uid 500); 23 May 2011 09:42:53 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 43416 invoked by uid 500); 23 May 2011 09:42:53 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 43409 invoked by uid 99); 23 May 2011 09:42:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 May 2011 09:42:53 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ayyagarikiran@gmail.com designates 209.85.220.178 as permitted sender) Received: from [209.85.220.178] (HELO mail-vx0-f178.google.com) (209.85.220.178) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 May 2011 09:42:46 +0000 Received: by vxc11 with SMTP id 11so4752645vxc.37 for ; Mon, 23 May 2011 02:42:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=On4TkqaswncOfFxbF9hvxFnEOMZFcjVERWpqOfIt1vQ=; b=WyPORDn3ccEiDpQTMOsIUlMl3utKCKeP/8Kmi1q5bva0iDrEYDVg7xbh27V1PH1nMh WGOG9zbCcpJ6XqEmJltH2PgNCprwrJjchOlQgLfnfJI+os0v1ciBbxHd0Ywssnk1u1/2 3/ne9kcSajTF/eugjzDORkbzHA/R+aGL41bc0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=TLT9dC334vatbydqzMVFKHJwz9GUyD8ycf7TTmS9wtGK2juS1r8OKCFONAJBA9H682 HArAtbmhc2F4FLW66+m+Iz1YCWrfMcX7OZZoUYL4t6G0dN5Sj8oFf7T94Klm7QIZ5KEu 68zOhYLVjLp48x/UXJAn9+6kpRbR4PTK/naN0= MIME-Version: 1.0 Received: by 10.52.96.134 with SMTP id ds6mr3126432vdb.27.1306143745783; Mon, 23 May 2011 02:42:25 -0700 (PDT) Sender: ayyagarikiran@gmail.com Received: by 10.52.184.35 with HTTP; Mon, 23 May 2011 02:42:25 -0700 (PDT) In-Reply-To: References: <4DD96690.8070200@datanomic.com> Date: Mon, 23 May 2011 15:12:25 +0530 X-Google-Sender-Auth: cIwx6PVdU6Shy7ws9sAYYH6UyVk Message-ID: Subject: Re: Embedding ApacheDS using DirectoryServiceBean etc From: Kiran Ayyagari To: Apache Directory Developers List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Mon, May 23, 2011 at 2:27 PM, Richard Evans wrote: > I'm not sure I get this. =A0It seems as though using DirectoryServiceBean= and ServiceBuilder just can never work because of this NPE. =A0Surely that= 's a bug? =A0I do create a schema manager in the XML: > > =A0 > =A0 =A0... > =A0 > > =A0 > =A0 =A0 > =A0 =A0 > =A0 =A0 > =A0 > > =A0 > =A0 =A0... > =A0 > > =A0 > what I mean is that the schema manager created in this way is not useful unless a schema loader is set. the procedure goes like this: SchemaLoader loader =3D new LdifSchemaLoader( schemaPartitionDirectory ); // <-- you can also use JarLdifSchemaLoader schemaManager =3D new DefaultSchemaManager( loader ); // We have to load the schema now, otherwise we won't be able // to initialize the Partitions, as we won't be able to parse // and normalize their suffix Dn schemaManager.loadAllEnabled(); HTH > Richard > > -----Original Message----- > From: ayyagarikiran@gmail.com [mailto:ayyagarikiran@gmail.com] On Behalf = Of Kiran Ayyagari > Sent: 22 May 2011 21:02 > To: Apache Directory Developers List > Subject: Re: Embedding ApacheDS using DirectoryServiceBean etc > > On Mon, May 23, 2011 at 1:10 AM, Richard Evans > wrote: >> I'm experimenting with embedding ApacheDS (1.5.8-SNAPSHOT built from tru= nk) >> using configuration beans created in Spring XML along with the >> ServiceBuilder. =A0I've attached where I've got to so far - it is not >> complete, but I've run into a couple of problems. >> >> Firstly I get an NPE: >> >> java.lang.NullPointerException >> =A0 =A0at >> org.apache.directory.server.core.schema.registries.synchronizers.Registr= ySynchronizerAdaptor.(RegistrySynchronizerAdaptor.java:123) >> =A0 =A0at >> org.apache.directory.server.core.schema.SchemaPartition.doInit(SchemaPar= tition.java:224) >> =A0 =A0at >> org.apache.directory.server.core.partition.AbstractPartition.initialize(= AbstractPartition.java:73) >> =A0 =A0at >> org.apache.directory.server.core.DefaultDirectoryService.initialize(Defa= ultDirectoryService.java:1484) >> =A0 =A0at >> org.apache.directory.server.core.DefaultDirectoryService.startup(Default= DirectoryService.java:962) >> =A0 =A0at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> =A0 =A0at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav= a:39) >> =A0 =A0at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor= Impl.java:25) >> =A0 =A0at java.lang.reflect.Method.invoke(Method.java:597) >> =A0 =A0at rde.tests.apacheds.LaunchADS.main(LaunchADS.java:49) >> >> It looks as though the SchemaManager instance is never set on the >> SchemaPartition created by DefaultSchemaService. >> > the SchemaManager won't be created by SchemaPartition automatically > rather we need to set it after loading > the schema with any of the available schema loaders. > > Take a look at the methods initSchemaLdifPartition and > initDirectoryService present in ApacheDsService class they might give > you an idea. > >> Secondly, in 1.5.7 the suffix for a partition was a string, now it's a D= n. >> =A0There are lots of constructors for the Dn object - which should be us= ed >> here? >> > you can use the one which takes a single string argument while > configuring, but in general it is good to use the Dn(SchemaManager, > String...) > if you have access to the schema manager. >> Thanks >> >> Richard >> > > > > -- > Kiran Ayyagari > --=20 Kiran Ayyagari