0

We are using OpenDJ SDK for connecting with Directory Services. Below mentioned is code.

 @Bean
    public LDAPConnectionFactory createConnectionFactory(){
        LDAPOptions ldapOptions = new LDAPOptions();
        ldapOptions.setTimeout(30, TimeUnit.SECONDS);
        final LDAPConnectionFactory factory = new LDAPConnectionFactory(host, port,ldapOptions);
      Connections.newFixedConnectionPool(factory,connectionPoolSize);
        return factory;
    }

connection pool size parameter is set to 10 at present. The code was working fine, suddenly it started returning null object for getConnection() method on factory. When I comment out Connections.newFixedConnectionPool statement it works as per expected. Are we missing anything.

user2775185
  • 1,099
  • 3
  • 17
  • 30

1 Answers1

1

If you are creating a fixed connection pool, you should request a connection from it, not from the factory. The issue is that you are actually not saving the returned pool.

Ludovic Poitou
  • 4,788
  • 2
  • 21
  • 30