6.5 SDK Software Load Balancer Setup

This topic has 0 replies, 1 voice, and was last updated 2 years, 3 months ago by iconfr4cs.

  • Author
  • #28251


    We’re migrating our client code from the 2.6 SDK to the 6.5 SDK. In the old SDK, we were able to manage connection to our OpenDJ instances with one of the software load balancer in SDK (org.forgerock.opendj.ldap.Connections.newLoadBalancer()). The new SDK looks like it can do the same but with a different setup.

    In our 6.5 code, the problem we’re seeing is that we’re not able to bind to the connection that is returned by the load balancer. In the DS server logs, we see the connection and the operation that we perform after our bind code, but we never see the bind in the logs. We’re connecting anonymously even though we’re binding in our code with a valid user. Because of this,
    subsequent operations on that connection fail with permission errors.

    If we remove the load balancer from the code and use the connection from the connection factory directly, everything works and we see the bind in the server logs. We think there’s something wrong with how we’re setting-up the load balancer in our code, but we’re not sure what we’re doing wrong.

    Is there something that we’re missing in the code that is causing the software load balancer connections to be anonymous even though we’re binding?

    Below is an example of our setup.

    – Thanks

    public void sampleCode(String ldapHost, int ldapPort, String bindName, String bindPass, String searchCn) throws Exception{

    Options options = Options.defaultOptions();

    LdapClient ldapClient = LdapClients.newLdapClient(ldapHost, ldapPort,options);
    ArrayList<LdapClient> ldapClients = new ArrayList<>();

    //Load balancer setup
    LdapClient loadBalancer = LdapClients.newLeastRequestsLoadBalancer(ldapClients, Options.defaultOptions());
    LdapConnectionFactory factory = new LdapConnectionFactory(loadBalancer);

    Connection connection = factory.getConnection();

    ConnectionEntryReader reader = connection.search(searchCn, SearchScope.WHOLE_SUBTREE, “(objectClass=*)”);

    while (reader.hasNext()) {

    if (reader.isEntry()) {

    SearchResultEntry entry = reader.readEntry();




Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

©2022 ForgeRock - we provide an identity and access platform to secure every online relationship for the enterprise market, educational sector and even entire countries. Click to view our privacy policy and terms of use.

Log in with your credentials

Forgot your details?