0

I am trying to connect my APi developed by wso2 MI VsCode to an OpenLDAP server running on Ubuntu WSL. I’m using the WSO2 LDAP connector (V2) to perform LDAP operations (search, authentecates), but every request fails with:

LDAP operation failed: Failed to create InitialContext using factory specified in hash table.

and I cound't identify the ource of the problem

WSO2 Micro Integrator: 4.4.0 on with te connector ([https://store.wso2.com/connector/esb-connector-ldap][1])

  • OpenLDAP: Running on Ubuntu 24.04 via WSL2 (IP: 172.25.32.169, Port:389)
  • LDAP access from WSL: Works fine locally (tested withl dapsearch)
  • Apache Directory Studio: Can connect to OpenLDAP using ldap://172.25.32.169:389

WSO2 MI LDAP connector config example:

        <ldap.searchEntry configKey="LdapConnection">
            <dn>ou=students,dc=example,dc=com</dn>
            <filters>uid=student1</filters>
            <attributes>uid,cn,mail</attributes>
            <objectClass>inetOrgPerson</objectClass>
            <scope>sub</scope>
            <limit>10</limit>
            <onlyOneReference>false</onlyOneReference>
            <allowEmptySearchResult>true</allowEmptySearchResult>
            <responseVariable>studentResult</responseVariable>
            <overwriteBody>false</overwriteBody>
        </ldap.searchEntry>

and:

        <ldap.authenticate configKey="LdapConnection">
            <dn>cn=admin,dc=example,dc=com</dn>
            <password>0000</password>
            <responseVariable>authResult</responseVariable>
            <overwriteBody>false</overwriteBody>
        </ldap.authenticate>
  <ldap.init>
    <connectionType>LDAP</connectionType>
    <secureConnection>false</secureConnection>
    <disableSSLCertificateChecking>true</disableSSLCertificateChecking>
    <providerUrl>ldap://172.25.32.169:389</providerUrl>
    <securityPrincipal>cn=admin,dc=example,dc=com</securityPrincipal>
    <securityCredentials>0000</securityCredentials>
    <timeout>30000</timeout>
    <connectionPoolingEnabled>false</connectionPoolingEnabled>
    <name>LdapConnection</name>
  </ldap.init>

my logs:

[2025-10-14 09:38:33,787]  INFO {LogMediator} - {api:LdapTestAPI POST /ldap-test/} Starting LDAP operations
[2025-10-14 09:38:33,904] ERROR {LogMediator} - {api:LdapTestAPI POST /ldap-test/} LDAP operation failed: Failed to create InitialContext using factory specified in hash table.
[2025-10-14 09:38:33,905] DEBUG {headers} - http-incoming-3 << HTTP/1.1 200 OK
[2025-10-14 09:38:33,905] DEBUG {headers} - http-incoming-3 << activityid: 26b76958-3b71-4ec7-a16d-400779e37914
[2025-10-14 09:38:33,905] DEBUG {headers} - http-incoming-3 << Accept: */*
[2025-10-14 09:38:33,905] DEBUG {headers} - http-incoming-3 << Access-Control-Allow-Origin: 
[2025-10-14 09:38:33,905] DEBUG {headers} - http-incoming-3 << Access-Control-Allow-Methods: POST
[2025-10-14 09:38:33,905] DEBUG {headers} - http-incoming-3 << Host: localhost:8290
[2025-10-14 09:38:33,905] DEBUG {headers} - http-incoming-3 << Accept-Encoding: gzip, compress, deflate, br
[2025-10-14 09:38:33,905] DEBUG {headers} - http-incoming-3 << Access-Control-Allow-Headers: 
[2025-10-14 09:38:33,905] DEBUG {headers} - http-incoming-3 << Content-Type: application/json; charset=UTF-8
[2025-10-14 09:38:33,905] DEBUG {headers} - http-incoming-3 << Date: Tue, 14 Oct 2025 08:38:33 GMT
[2025-10-14 09:38:33,905] DEBUG {headers} - http-incoming-3 << Transfer-Encoding: chunked
[2025-10-14 09:38:33,905] DEBUG {headers} - http-incoming-3 << Connection: close
[2025-10-14 09:38:33,906] DEBUG {wire} - HTTP-Listener I/O dispatcher-2 << "HTTP/1.1 200 OK[\r][\n]"
[2025-10-14 09:38:33,906] DEBUG {wire} - HTTP-Listener I/O dispatcher-2 << "activityid: 26b76958-3b71-4ec7-a16d-400779e37914[\r][\n]"
[2025-10-14 09:38:33,906] DEBUG {wire} - HTTP-Listener I/O dispatcher-2 << "Accept: */*[\r][\n]"
[2025-10-14 09:38:33,906] DEBUG {wire} - HTTP-Listener I/O dispatcher-2 << "Access-Control-Allow-Origin: [\r][\n]"
[2025-10-14 09:38:33,906] DEBUG {wire} - HTTP-Listener I/O dispatcher-2 << "Access-Control-Allow-Methods: POST[\r][\n]"
[2025-10-14 09:38:33,906] DEBUG {wire} - HTTP-Listener I/O dispatcher-2 << "Host: localhost:8290[\r][\n]"
[2025-10-14 09:38:33,906] DEBUG {wire} - HTTP-Listener I/O dispatcher-2 << "Accept-Encoding: gzip, compress, deflate, br[\r][\n]"
[2025-10-14 09:38:33,906] DEBUG {wire} - HTTP-Listener I/O dispatcher-2 << "Access-Control-Allow-Headers: [\r][\n]"
[2025-10-14 09:38:33,907] DEBUG {wire} - HTTP-Listener I/O dispatcher-2 << "Content-Type: application/json; charset=UTF-8[\r][\n]"
[2025-10-14 09:38:33,907] DEBUG {wire} - HTTP-Listener I/O dispatcher-2 << "Date: Tue, 14 Oct 2025 08:38:33 GMT[\r][\n]"
[2025-10-14 09:38:33,907] DEBUG {wire} - HTTP-Listener I/O dispatcher-2 << "Transfer-Encoding: chunked[\r][\n]"
[2025-10-14 09:38:33,907] DEBUG {wire} - HTTP-Listener I/O dispatcher-2 << "Connection: close[\r][\n]"
[2025-10-14 09:38:33,907] DEBUG {wire} - HTTP-Listener I/O dispatcher-2 << "[\r][\n]"
[2025-10-14 09:38:33,907] DEBUG {wire} - HTTP-Listener I/O dispatcher-2 << "bd[\r][\n]"
[2025-10-14 09:38:33,907] DEBUG {wire} - HTTP-Listener I/O dispatcher-2 << "{[\n]"
[2025-10-14 09:38:33,907] DEBUG {wire} - HTTP-Listener I/O dispatcher-2 << "                        "error": "LDAP operation failed",[\n]"
[2025-10-14 09:38:33,907] DEBUG {wire} - HTTP-Listener I/O dispatcher-2 << "                        "message": "Failed to create InitialContext using factory specified in hash table."[\n]"
[2025-10-14 09:38:33,907] DEBUG {wire} - HTTP-Listener I/O dispatcher-2 << "                    }[\r][\n]"
[2025-10-14 09:38:33,907] DEBUG {wire} - HTTP-Listener I/O dispatcher-2 << "0[\r][\n]"
[2025-10-14 09:38:33,907] DEBUG {wire} - HTTP-Listener I/O dispatcher-2 << "[\r][\n]"


[1]: https://store.wso2.com/connector/esb-connector-ldap

1 Answer 1

0

When disableSSLCertificateChecking is set to true, the default socket factory is overridden by a custom SSL socket factory, which triggers this error over plain LDAP. Please set disableSSLCertificateChecking it to false and try again.

<ldap.init>
  <connectionType>LDAP</connectionType>
  <secureConnection>false</secureConnection>
  <disableSSLCertificateChecking>false</disableSSLCertificateChecking>
  <providerUrl>ldap://172.25.32.169:389</providerUrl>
  <securityPrincipal>cn=admin,dc=example,dc=com</securityPrincipal>
  <securityCredentials>0000</securityCredentials>
  <timeout>30000</timeout>
  <connectionPoolingEnabled>false</connectionPoolingEnabled>
  <name>LdapConnection</name>
</ldap.init>
Sign up to request clarification or add additional context in comments.

1 Comment

even with setting the disableSSLCertificateChecking set to false i have the same problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.