You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Derek Alexander <D....@lse.ac.uk> on 2007/09/04 17:46:39 UTC

Re: Shutdown and multiple ADS instances



Derek Alexander wrote:
> 
> Am looking to use ADS within an integration test for some LDAP
> failover/recovery code.
> For this I want to use three instances and starting and stopping at
> appropriate points in the test.
> 

Further to my original post, I've delved a bit deeper. It seems after all
that one can have multiple instances per JVM.

Have found the constructors for MutableServerStartupConfiguration and
ShutdownConfiguration that take a String instanceId param.

However, using 1.0.2 ran into a problem where if I start two instances at
once and then stop them, I get this warning:

15402 [main] WARN  org.apache.directory.server.jndi.ServerContextFactory  -
Failed to sent NoD.
java.lang.IllegalArgumentException: Address not bound: 0.0.0.0/0.0.0.0:40389
        at
org.apache.mina.transport.socket.nio.SocketAcceptor.unbind(SocketAcceptor.java:226)
        at
org.apache.directory.server.jndi.ServerContextFactory.stopLDAP0(ServerContextFactory.java:619)
        at
org.apache.directory.server.jndi.ServerContextFactory.afterShutdown(ServerContextFactory.java:130)
        at
org.apache.directory.server.core.DefaultDirectoryService.shutdown(DefaultDirectoryService.java:279)
        at
org.apache.directory.server.core.jndi.AbstractContextFactory.getInitialContext(AbstractContextFactory.java:110)

followed by an error when I try to start them again:

org.apache.directory.shared.ldap.exception.LdapConfigurationException:
Failed to bind an LDAP service (40389) to the service registry. [Root
exception is java.net.BindException: Address already in use]
        at
org.apache.directory.server.jndi.ServerContextFactory.startLDAP0(ServerContextFactory.java:499)
        at
org.apache.directory.server.jndi.ServerContextFactory.startLDAP(ServerContextFactory.java:413)
        at
org.apache.directory.server.jndi.ServerContextFactory.afterStartup(ServerContextFactory.java:212)
        at
org.apache.directory.server.core.DefaultDirectoryService.startup(DefaultDirectoryService.java:239)
        at
org.apache.directory.server.core.jndi.AbstractContextFactory.getInitialContext(AbstractContextFactory.java:118)
...
Caused by: java.net.BindException: Address already in use
        at sun.nio.ch.Net.bind(Native Method)
        at
sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:119)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
        at
org.apache.mina.transport.socket.nio.SocketAcceptor.registerNew(SocketAcceptor.java:429)
        at
org.apache.mina.transport.socket.nio.SocketAcceptor.access$900(SocketAcceptor.java:52)
        at
org.apache.mina.transport.socket.nio.SocketAcceptor$Worker.run(SocketAcceptor.java:258)
        at
org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:43)
        at java.lang.Thread.run(Thread.java:595)


Figured to try out 1.5.1 instead, the examples don't seem to have been
updated since 1.0.x, so I'm a bit in the dark here. Am getting the following
error. Perhaps I'm missing a dependency?

org.apache.directory.server.schema.bootstrap.partition.UniqueResourceException:
Problem locating bootstrap partition database file list.  Be sure there is
exactly one bootstrap partition jar in your classpath.
No resources named
'org/apache/directory/server/schema/bootstrap/partition/DBFILES' located on
classpath
        at
org.apache.directory.server.schema.bootstrap.partition.DbFileListing.getUniqueResource(DbFileListing.java:139)
        at
org.apache.directory.server.schema.bootstrap.partition.DbFileListing.getUniqueResourceAsStream(DbFileListing.java:129)
        at
org.apache.directory.server.schema.bootstrap.partition.DbFileListing.init(DbFileListing.java:82)
        at
org.apache.directory.server.schema.bootstrap.partition.DbFileListing.<init>(DbFileListing.java:51)
        at
org.apache.directory.server.schema.bootstrap.partition.SchemaPartitionExtractor.<init>(SchemaPartitionExtractor.java:43)
        at
org.apache.directory.server.core.DefaultDirectoryService.initialize(DefaultDirectoryService.java:834)
        at
org.apache.directory.server.core.DefaultDirectoryService.startup(DefaultDirectoryService.java:255)
        at
org.apache.directory.server.core.jndi.AbstractContextFactory.getInitialContext(AbstractContextFactory.java:124)
        at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
        at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
        at javax.naming.InitialContext.init(InitialContext.java:223)
        at javax.naming.InitialContext.<init>(InitialContext.java:197)
        at
javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:82)

Any pointers appreciated.

Thanks,
Derek



-- 
View this message in context: http://www.nabble.com/Shutdown-and-multiple-ADS-instances-tf4360101.html#a12480841
Sent from the Apache Directory Project mailing list archive at Nabble.com.


Re: Shutdown and multiple ADS instances

Posted by Derek Alexander <D....@lse.ac.uk>.


djencks wrote:
> 
> For 1.5.1 you need to include o.a.d.server/apacheds-bootstrap- 
> partition/1.5.1/jar in your classpath, probably as a maven dependency???
> 

Thanks, it works with 1.5.1.

Am now able to startup and shutdown multiple instances within a single JVM,
each listening on a different port.

One thing to report though, when shutting down an instance I am getting the
following error:

60805 [pool-24-thread-6] ERROR
org.apache.directory.server.ldap.support.UnbindHandler  - failed to unbind
session properly
org.apache.directory.shared.ldap.exception.LdapNameNotFoundException:
uid=admin,ou=system
        at
org.apache.directory.server.core.partition.DefaultPartitionNexus.getPartition(DefaultPartitionNexus.java:1114)
        at
org.apache.directory.server.core.partition.DefaultPartitionNexus.unbind(DefaultPartitionNexus.java:773)
        at
org.apache.directory.server.core.interceptor.InterceptorChain$1.unbind(InterceptorChain.java:210)
        at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.unbind(InterceptorChain.java:1412)
        at
org.apache.directory.server.core.interceptor.BaseInterceptor.unbind(BaseInterceptor.java:229)
        at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.unbind(InterceptorChain.java:1412)
        at
org.apache.directory.server.core.interceptor.BaseInterceptor.unbind(BaseInterceptor.java:229)
        at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.unbind(InterceptorChain.java:1412)
        at
org.apache.directory.server.core.interceptor.BaseInterceptor.unbind(BaseInterceptor.java:229)
        at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.unbind(InterceptorChain.java:1412)
        at
org.apache.directory.server.core.interceptor.BaseInterceptor.unbind(BaseInterceptor.java:229)
        at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.unbind(InterceptorChain.java:1412)
        at
org.apache.directory.server.core.interceptor.BaseInterceptor.unbind(BaseInterceptor.java:229)
        at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.unbind(InterceptorChain.java:1412)
        at
org.apache.directory.server.core.interceptor.BaseInterceptor.unbind(BaseInterceptor.java:229)
        at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.unbind(InterceptorChain.java:1412)
        at
org.apache.directory.server.core.interceptor.BaseInterceptor.unbind(BaseInterceptor.java:229)
        at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.unbind(InterceptorChain.java:1412)
        at
org.apache.directory.server.core.interceptor.BaseInterceptor.unbind(BaseInterceptor.java:229)
        at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.unbind(InterceptorChain.java:1412)
        at
org.apache.directory.server.core.interceptor.BaseInterceptor.unbind(BaseInterceptor.java:229)
        at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.unbind(InterceptorChain.java:1412)
        at
org.apache.directory.server.core.interceptor.BaseInterceptor.unbind(BaseInterceptor.java:229)
        at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.unbind(InterceptorChain.java:1412)
        at
org.apache.directory.server.core.interceptor.BaseInterceptor.unbind(BaseInterceptor.java:229)
        at
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.unbind(InterceptorChain.java:1412)
        at
org.apache.directory.server.core.interceptor.BaseInterceptor.unbind(BaseInterceptor.java:229)
        at
org.apache.directory.server.core.interceptor.InterceptorChain.unbind(InterceptorChain.java:794)
        at
org.apache.directory.server.core.partition.PartitionNexusProxy.unbind(PartitionNexusProxy.java:684)
        at
org.apache.directory.server.core.partition.PartitionNexusProxy.unbind(PartitionNexusProxy.java:701)
        at
org.apache.directory.server.core.jndi.ServerLdapContext.ldapUnbind(ServerLdapContext.java:210)
        at
org.apache.directory.server.ldap.support.UnbindHandler.messageReceived(UnbindHandler.java:58)
        at
org.apache.mina.handler.demux.DemuxingIoHandler.messageReceived(DemuxingIoHandler.java:141)
        at
org.apache.directory.server.ldap.LdapProtocolProvider$LdapProtocolHandler.messageReceived(LdapProtocolProvider.java:428)
        at
org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:570)
        at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
        at
org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)
        at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)
        at
org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput.flush(SimpleProtocolDecoderOutput.java:58)
        at
org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:176)
        at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
        at
org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)
        at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)
        at
org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220)
        at
org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)


This only happens if the instance has been used (i.e. if an ldap connection
has been made). If I simply startup then stop an instance this error doesn't
occur. Can post more details if this is of interest.

Regards,
Derek




-- 
View this message in context: http://www.nabble.com/Shutdown-and-multiple-ADS-instances-tf4360101.html#a12495971
Sent from the Apache Directory Project mailing list archive at Nabble.com.


Re: Shutdown and multiple ADS instances

Posted by David Jencks <da...@yahoo.com>.
I don't know anything about 1.0.x.

For 1.5.1 you need to include o.a.d.server/apacheds-bootstrap- 
partition/1.5.1/jar in your classpath, probably as a maven dependency???

You'll need to figure out some way to either get each server to bind  
to different ports or to prevent them from binding to  any ports and  
use in-vm access. (this appears to be the problem you got using 1.0.x)

IIUC how to set up servers like this is likely to change soon in  
trunk, hopefully to something easier to understand and do :-)

thanks
david jencks

On Sep 4, 2007, at 8:46 AM, Derek Alexander wrote:

>
>
>
> Derek Alexander wrote:
>>
>> Am looking to use ADS within an integration test for some LDAP
>> failover/recovery code.
>> For this I want to use three instances and starting and stopping at
>> appropriate points in the test.
>>
>
> Further to my original post, I've delved a bit deeper. It seems  
> after all
> that one can have multiple instances per JVM.
>
> Have found the constructors for MutableServerStartupConfiguration and
> ShutdownConfiguration that take a String instanceId param.
>
> However, using 1.0.2 ran into a problem where if I start two  
> instances at
> once and then stop them, I get this warning:
>
> 15402 [main] WARN   
> org.apache.directory.server.jndi.ServerContextFactory  -
> Failed to sent NoD.
> java.lang.IllegalArgumentException: Address not bound:  
> 0.0.0.0/0.0.0.0:40389
>         at
> org.apache.mina.transport.socket.nio.SocketAcceptor.unbind 
> (SocketAcceptor.java:226)
>         at
> org.apache.directory.server.jndi.ServerContextFactory.stopLDAP0 
> (ServerContextFactory.java:619)
>         at
> org.apache.directory.server.jndi.ServerContextFactory.afterShutdown 
> (ServerContextFactory.java:130)
>         at
> org.apache.directory.server.core.DefaultDirectoryService.shutdown 
> (DefaultDirectoryService.java:279)
>         at
> org.apache.directory.server.core.jndi.AbstractContextFactory.getInitia 
> lContext(AbstractContextFactory.java:110)
>
> followed by an error when I try to start them again:
>
> org.apache.directory.shared.ldap.exception.LdapConfigurationException:
> Failed to bind an LDAP service (40389) to the service registry. [Root
> exception is java.net.BindException: Address already in use]
>         at
> org.apache.directory.server.jndi.ServerContextFactory.startLDAP0 
> (ServerContextFactory.java:499)
>         at
> org.apache.directory.server.jndi.ServerContextFactory.startLDAP 
> (ServerContextFactory.java:413)
>         at
> org.apache.directory.server.jndi.ServerContextFactory.afterStartup 
> (ServerContextFactory.java:212)
>         at
> org.apache.directory.server.core.DefaultDirectoryService.startup 
> (DefaultDirectoryService.java:239)
>         at
> org.apache.directory.server.core.jndi.AbstractContextFactory.getInitia 
> lContext(AbstractContextFactory.java:118)
> ...
> Caused by: java.net.BindException: Address already in use
>         at sun.nio.ch.Net.bind(Native Method)
>         at
> sun.nio.ch.ServerSocketChannelImpl.bind 
> (ServerSocketChannelImpl.java:119)
>         at sun.nio.ch.ServerSocketAdaptor.bind 
> (ServerSocketAdaptor.java:59)
>         at
> org.apache.mina.transport.socket.nio.SocketAcceptor.registerNew 
> (SocketAcceptor.java:429)
>         at
> org.apache.mina.transport.socket.nio.SocketAcceptor.access$900 
> (SocketAcceptor.java:52)
>         at
> org.apache.mina.transport.socket.nio.SocketAcceptor$Worker.run 
> (SocketAcceptor.java:258)
>         at
> org.apache.mina.util.NamePreservingRunnable.run 
> (NamePreservingRunnable.java:43)
>         at java.lang.Thread.run(Thread.java:595)
>
>
> Figured to try out 1.5.1 instead, the examples don't seem to have been
> updated since 1.0.x, so I'm a bit in the dark here. Am getting the  
> following
> error. Perhaps I'm missing a dependency?
>
> org.apache.directory.server.schema.bootstrap.partition.UniqueResourceE 
> xception:
> Problem locating bootstrap partition database file list.  Be sure  
> there is
> exactly one bootstrap partition jar in your classpath.
> No resources named
> 'org/apache/directory/server/schema/bootstrap/partition/DBFILES'  
> located on
> classpath
>         at
> org.apache.directory.server.schema.bootstrap.partition.DbFileListing.g 
> etUniqueResource(DbFileListing.java:139)
>         at
> org.apache.directory.server.schema.bootstrap.partition.DbFileListing.g 
> etUniqueResourceAsStream(DbFileListing.java:129)
>         at
> org.apache.directory.server.schema.bootstrap.partition.DbFileListing.i 
> nit(DbFileListing.java:82)
>         at
> org.apache.directory.server.schema.bootstrap.partition.DbFileListing.< 
> init>(DbFileListing.java:51)
>         at
> org.apache.directory.server.schema.bootstrap.partition.SchemaPartition 
> Extractor.<init>(SchemaPartitionExtractor.java:43)
>         at
> org.apache.directory.server.core.DefaultDirectoryService.initialize 
> (DefaultDirectoryService.java:834)
>         at
> org.apache.directory.server.core.DefaultDirectoryService.startup 
> (DefaultDirectoryService.java:255)
>         at
> org.apache.directory.server.core.jndi.AbstractContextFactory.getInitia 
> lContext(AbstractContextFactory.java:124)
>         at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java: 
> 667)
>         at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
>         at javax.naming.InitialContext.init(InitialContext.java:223)
>         at javax.naming.InitialContext.<init>(InitialContext.java:197)
>         at
> javax.naming.directory.InitialDirContext.<init> 
> (InitialDirContext.java:82)
>
> Any pointers appreciated.
>
> Thanks,
> Derek
>
>
>
> -- 
> View this message in context: http://www.nabble.com/Shutdown-and- 
> multiple-ADS-instances-tf4360101.html#a12480841
> Sent from the Apache Directory Project mailing list archive at  
> Nabble.com.
>