spring-boottestingldapapacheds

ApacheDS error in spring boot tests to simulate a LDAP connection


I'm using ApacheDS for testing a Spring Boot application to simulate a LDAP connection.

It is working fine, but depending on the environment in which I run it, it gives the attached error during the tests execution.The project is cloned in two pc's, one is a local machine (and tests don't show errors) and a clone that is running on a remote desktop (both Windows, but this one, has a LDAP connection to run a real environment).

On the remote desktop is working, but showing the attached error (I'm changing the ApacheDS IP but I continue seeing the error).

[pool-4-thread-1] WARN org.apache.directory.server.ldap.LdapProtocolHandler -- Unexpected exception forcing session to close: sending disconnect notice to client. java.lang.NullPointerException: Cannot invoke "org.apache.directory.server.ldap.LdapSession.setLdapServer(org.apache.directory.server.ldap.LdapServer)" because "ldapSession" is null at org.apache.directory.server.ldap.handlers.LdapRequestHandler.handleMessage(LdapRequestHandler.java:129) at org.apache.directory.server.ldap.handlers.LdapRequestHandler.handleMessage(LdapRequestHandler.java:56) at org.apache.mina.handler.demux.DemuxingIoHandler.messageReceived(DemuxingIoHandler.java:232) at org.apache.directory.server.ldap.LdapProtocolHandler.messageReceived(LdapProtocolHandler.java:194)

This is the configuration for my tests

ldap.url=ldap://localhost:18888
ldap.port=18888
ldap.ldiffile=classpath:/test.ldif
ldap.partitionSuffix=OU=COFFEEIEC,OU=IntermediaDA,DC=test,DC=com
ldap.principal=uid=admin,ou=system
ldap.password=secret

And the dependencies I'm using

<dependency>
    <groupId>org.apache.directory.server</groupId>
    <artifactId>apacheds-server-jndi</artifactId>
    <version>1.5.5</version>
    <scope>test</scope>
</dependency>     
<dependency>
  <groupId>org.apache.directory.server</groupId>
  <artifactId>apacheds-protocol-ldap</artifactId>
  <version>1.5.5</version>
  <scope>test</scope>     
</dependency>

Solution

  • I removed the error adding this dependency

    <dependency>
        <groupId>com.unboundid</groupId>
        <artifactId>unboundid-ldapsdk</artifactId>
        <scope>test</scope>
    </dependency>