使用LDAP登录OpenJDK

问题描述 投票:0回答:1

我在使用LDAP登录时遇到问题;我使用OpenJDK 11.0.2,tomcat V7和我使用MacOS High Sierra(版本10.13.6)遵循以下代码:

Hashtable<String, Object> env = new Hashtable<String, Object>();
    env.put(Context.SECURITY_AUTHENTICATION, "simple");

    if(email != null) {
        env.put(Context.SECURITY_PRINCIPAL, ldapUsername);
    }
    if(pwd != null) {
        env.put(Context.SECURITY_CREDENTIALS, ldapPassword);
    }
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL, ldapServer); 

    log.info("Connecting...");
        ctx = new InitialLdapContext(env, null);

当我到达这里时,我收到以下错误:

javax.naming.CommunicationException: simple bind failed: PROVIDER_URL_ SERVER [Root exception is java.net.SocketException: Connection or outbound has closed]

如果我使用Oracle JDK代码可以工作。我将JAVA_HOME从ORACLE JDK更改为OpenJDK,是否必须执行其他操作?

java oracle login ldap tomcat7
1个回答
0
投票

确保LDAPS的SSL证书安装在OpenJDK的密钥库中,您可能在Oracle JDK的密钥库中有证书,但在OpenJDK的密钥库中没有。

© www.soinside.com 2019 - 2024. All rights reserved.