yea, i moved it from before server.start() to before service.startup() and it works fine. Guess the names look so similar I assumed it was in the right spot. Thanks for the help
David On Wed, Sep 21, 2011 at 4:06 PM, Kiran Ayyagari <[email protected]>wrote: > again, I doubt that the service is getting started even before you > call this startServer() > can you check the other function(s) which are called before calling > startServer() > (and post that code if you still have issues, if it is sensitive share > with me the relevant parts alone) > > On Wed, Sep 21, 2011 at 3:33 PM, david jones <[email protected]> wrote: > > here's the routine with the guts: > > > > public void startServer() throws Exception > > { > > server = new LdapServer(); > > server.setTransports( new TcpTransport( getPort() ) ); > > server.setDirectoryService( service ); > > server.setAllowAnonymousAccess(false); > > > > boolean made = (new File(ServerConstants.LDAP_FOLDER)).mkdir(); > > > > service.setWorkingDirectory(new > > File(OfmConstants.DATA_DIR_BASE+ServerConstants.LDAP_FOLDER)); > > System.out.println("Set LDAP working directory to: " + > > service.getWorkingDirectory()); > > > > server.start(); > > > > } > > > > Note: the print stmt outputs: Working Dir is C:\data\ldap > > But server-work/schema and server-work/server are created in the > > applications root directory > > > > On Wed, Sep 21, 2011 at 11:40 AM, Kiran Ayyagari <[email protected] > >wrote: > > > >> On Wed, Sep 21, 2011 at 11:33 AM, david jones <[email protected]> > wrote: > >> > It doesn't need to be after the service is started, isn't there a way > >> during > >> > initialization to say I want all my ldap files to go somewhere besides > >> the > >> > default? > >> > > >> there is, use the setWorkingDirectory(), I suspect that your app is > >> not setting this value properly > >> or there seems to be something else going wrong, it will be helpful if > >> you paste the code used for > >> initializing the server/service in your app > >> > >> > I'm thinking about possibilities such as a 2nd instance of the app > runs > >> in > >> > a different directory, but can use the ldap data from the first, maybe > >> for a > >> > cheap and quick cold start redundancy > >> > > >> nah, the same data directory cannot be used by two instances (very > >> dangerous!) > >> but in general the time taken to start the directory is very > >> negligible, are you doing some time consuming task during startup? > >> > On Wed, Sep 21, 2011 at 8:51 AM, Kiran Ayyagari <[email protected] > >> >wrote: > >> > > >> >> On Wed, Sep 21, 2011 at 8:42 AM, david jones <[email protected]> > >> wrote: > >> >> > Thanks, yes i've read your link and can read in a LDIF schema from > the > >> >> > default directory or by specifying one on LdifFileLoader. > >> >> > > >> >> > my main problem is changing the directories for output, how can i > >> change > >> >> the > >> >> still not clear why would you want to do that, once the service is > >> >> started changing the working directory > >> >> will not have any effect and doing so might have unknown consequences > >> >> > location of where the ldap data is stored? What does > >> setWorkingDirectory > >> >> do, > >> >> > and are there any release or environment restrictions to it (it > seems > >> to > >> >> do > >> >> > nothing for me) > >> >> > > >> >> setWorkingDirectory() sets the main folder where ALL the ldap > server's > >> >> data is stored > >> >> > thanks, > >> >> > david > >> >> > > >> >> > On Tue, Sep 20, 2011 at 6:40 PM, Kiran Ayyagari < > [email protected] > >> >> >wrote: > >> >> > > >> >> >> I guess you want to add some new schema to the directory, if that > is > >> >> >> correct you need to add > >> >> >> them directly to the ou=schema partition. > >> >> >> > >> >> >> This section [1] will help you in understanding the format of the > >> schema > >> >> >> entries > >> >> >> > >> >> >> [1] > >> >> >> > >> >> > >> > http://directory.apache.org/apacheds/1.5/31-add-your-first-elements-to-the-schema.html#3.1.Addyourfirstelementstotheschema-UsingApacheDirectoryStudioSchemaEditortoloadthenewschemaelements > >> >> >> > >> >> >> On Tue, Sep 20, 2011 at 5:13 PM, david jones <[email protected] > > > >> >> wrote: > >> >> >> > i'm having trouble changing the directories of where the ldif is > >> read > >> >> >> from > >> >> >> > and/or where the ldap data is stored. > >> >> >> > > >> >> >> > 1) The below works if i set NEW_DIR to an absolute path: > >> >> >> > > >> >> >> > LdifFileLoader ldifLoader = new > >> >> >> LdifFileLoader(service.getAdminSession(), > >> >> >> > NEW_DIR + "/newSchema.ldif"); > >> >> >> > ldifLoader.execute(); > >> >> >> > > >> >> >> > 2) But this does not work, i.e. its looking in > >> >> >> > System.getProperty("user.dir");, not DIFFERENT_DIR for the ldif > >> file > >> >> >> > > >> >> >> > service.setWorkingDirectory(new File(DIFFERENT_DIR)); > >> >> >> > LdifFileLoader ldifLoader = new > >> >> LdifFileLoader(service.getAdminSession(), > >> >> >> > "/newSchema.ldif"); > >> >> >> > > >> >> >> > 3) Is there away to change where the schema and system folders > are > >> >> >> stored? > >> >> >> > They seem to always go in to "user.dir"/server-work > >> >> >> > > >> >> >> > 4) does being on 1.5.5 vs. being on 1.5.6,1.5.7 change this > >> behavior? > >> >> >> > > >> >> >> > 5) does creating a new partition instead of adding my new schema > >> >> elements > >> >> >> in > >> >> >> > cn=other,ou=schema help/hinder this or anything else? > >> >> >> > > >> >> >> > thanks, > >> >> >> > david > >> >> >> > > >> >> >> > On Tue, Sep 20, 2011 at 1:11 PM, Kiran Ayyagari < > >> [email protected] > >> >> >> >wrote: > >> >> >> > > >> >> >> >> On Tue, Sep 20, 2011 at 12:59 PM, david jones < > >> [email protected]> > >> >> >> wrote: > >> >> >> >> > For an embedded server, is it possible to read an ldif in > from 1 > >> >> >> >> directory > >> >> >> >> > (i.e packaged with the product) , and store LDAP data > >> >> >> >> (server-work/system) > >> >> >> >> > in a different one (i.e. outside of the product directory)? > >> >> >> >> > > >> >> >> >> no, it is not possible in the way you are doing, > >> >> >> >> > >> >> >> >> > I'm using apacheds 1.5, i tried the below code, but it seems > to > >> be > >> >> >> >> ignored > >> >> >> >> > when reading in my ldif: > >> >> >> >> > service.setWorkingDirectory(new File("\newdir")); > >> >> >> >> > > >> >> >> >> > Currently i'm adding my schema changes to ou=schema,cn=other, > >> does > >> >> >> that > >> >> >> >> > affect ldif input vs. creating a new partition? > >> >> >> >> > > >> >> >> >> sorry didn't understand, can you elaborate a bit about the > above > >> two > >> >> >> >> questions > >> >> >> >> > > >> >> >> >> > Thanks, > >> >> >> >> > David > >> >> >> >> > > >> >> >> >> > >> >> >> >> > >> >> >> >> > >> >> >> >> -- > >> >> >> >> Kiran Ayyagari > >> >> >> >> > >> >> >> > > >> >> >> > > >> >> >> > > >> >> >> > -- > >> >> >> > David Jones > >> >> >> > [email protected] > >> >> >> > c) 302-5648 > >> >> >> > > >> >> >> > >> >> >> > >> >> >> > >> >> >> -- > >> >> >> Kiran Ayyagari > >> >> >> > >> >> > > >> >> > > >> >> > > >> >> > -- > >> >> > David Jones > >> >> > [email protected] > >> >> > c) 302-5648 > >> >> > > >> >> > >> >> > >> >> > >> >> -- > >> >> Kiran Ayyagari > >> >> > >> > > >> > > >> > > >> > -- > >> > David Jones > >> > [email protected] > >> > c) 302-5648 > >> > > >> > >> > >> > >> -- > >> Kiran Ayyagari > >> > > > > > > > > -- > > David Jones > > [email protected] > > c) 302-5648 > > > > > > -- > Kiran Ayyagari > -- David Jones [email protected] c) 302-5648
