Java – how do I enable connection pooling via LDAP SSL?

OK, so I connect my application from non SSL to the SSL connection of my LDAP server When running an application in non SSL, the connection pool works normally But when I switch to SSL, the connection pool is no longer valid

When studying here, I realized that I never set the "com. Sun. JNDI. LDAP. Connect. Pool. Protocol" attribute to "plain SSL" because it is set to plain by default I think that's the problem

When I implemented the change to include "plain SSL", it did not solve the problem and still did not use the connection pool

Do I lack any other settings?

Relevant codes:

Hashtable LDAPEnvironment = new Hashtable();
    LDAPEnvironment.put(Context.Security_AUTHENTICATION,Security_AUTHENTICATION);
    LDAPEnvironment.put(Context.Security_PRINCIPAL,Security_PRINCIPAL);
    LDAPEnvironment.put(Context.Security_CREDENTIALS,Security_CREDENTIALS);
    LDAPEnvironment.put(Context.INITIAL_CONTEXT_FACTORY,INITIAL_CONTEXT_FACTORY);
    LDAPEnvironment.put(Context.PROVIDER_URL,PROVIDER_URL );
    LDAPEnvironment.put(Context.Security_AUTHENTICATION,"simple");
    LDAPEnvironment.put("java.naming.ldap.version",versionOfLDAP );

    if (ldapProtocol != null && ldapProtocol.equalsIgnoreCase("SSL")){
        LDAPEnvironment.put(Context.Security_PROTOCOL,"ssl");
        LDAPEnvironment.put("com.sun.jndi.ldap.connect.pool.protocol","plain ssl");
    }

    LDAPEnvironment.put("com.sun.jndi.ldap.connect.pool","true");

Solution

I found the problem The document clearly indicates that these attributes are system attributes rather than environment attributes I set them as environment properties

The above is the Java collected by programming house for you - how to enable connection pooling through LDAP and SSL? I hope this article can help you solve Java - how to enable connection pooling through LDAP and SSL? Program development problems encountered.

If you think the content of the programming home website is good, you are welcome to recommend the programming home website to programmers and friends.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>