Tagged: sdk, software load balancer
This topic has 0 replies, 1 voice, and was last updated 5 months, 4 weeks ago by iconfr4cs.
-
AuthorPosts
-
September 2, 2020 at 4:52 pm #28251
iconfr4cs
ParticipantHi,
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<>();
ldapClients.add(ldapClient);//Load balancer setup
LdapClient loadBalancer = LdapClients.newLeastRequestsLoadBalancer(ldapClients, Options.defaultOptions());
LdapConnectionFactory factory = new LdapConnectionFactory(loadBalancer);Connection connection = factory.getConnection();
connection.bind(bindName,bindPass.toCharArray());ConnectionEntryReader reader = connection.search(searchCn, SearchScope.WHOLE_SUBTREE, “(objectClass=*)”);
while (reader.hasNext()) {
if (reader.isEntry()) {
SearchResultEntry entry = reader.readEntry();
//…}
}
}
-
AuthorPosts
You must be logged in to reply to this topic.