[email protected]
[Top] [All Lists]

Re: NullPointerException in assertSubtreeScope

Subject: Re: NullPointerException in assertSubtreeScope
From: Emmanuel Lecharny
Date: Tue, 12 Feb 2008 15:18:18 +0100
Icky Dude wrote:

Yes, the NPE occurs on line ScopeEvaluator.java:94 because dn is null.
 Yes node is non-null.

I get the NPE when initializing a DefaultDirectoryService (in what I
think is the simplest possible way).  I'm pretty sure I'm using right
bootstrap jars because I just built them and installed them into my my


I can reproduce the problem using the following code (sorry there are
some minor syntax problems having some problems cut-n-paste to my
webmail) :

--- begin code ---

import org.apache.directory.server.core.DefaultDirectoryService;
import org.apache.directory.server.ldap.LdapServer;
import org.apache.directory.server.protocol.shared.SocketAcceptor;
import org.apache.mina.common.ByteBuffer;
import org.apache.mina.common.SimpleByteBufferAllocator;
iimport javax.naming.NamingException;
import java.io.IOException;

class HelloWorldImaDirectory
        private static int LDAP_PORT = 389;
        public static void main( String[] args)
                DefaultDirectoryService directoryService = new 
                LdapServer ldapServer = new LdapServer();
                ByteBuffer.setAllocator( new SimpleByteBufferAllocator() );
                ByteBuffer.setUseDirectBuffers( false );
                SocketAcceptor tcpAcceptor = new SocketAcceptor( null );        
                ldapServer.setSocketAcceptor( tcpAcceptor );
                ldapServer.setDirectoryService( directoryService );     
You have to add this line here :

Otherwise the schemas won't be loaded, leading to NPE all over the execution...

cordialement, regards,
Emmanuel Lécharny

<Prev in Thread] Current Thread [Next in Thread>