Java 8 到 Java 11:包 com.sun.jndi.ldap 不可见
Java 8 to Java 11: package com.sun.jndi.ldap is not visible
从 Java8 移动到 Java11 后,我收到错误 "package com.sun.jndi.ldap is not visible"。但是我需要这个包用于 Class LdapCtxFactory。包裹是否已移动或我应该为我的 Ldap 连接使用另一个 Class?
此致
因为您对 class LdapCtxFactory
的唯一使用是配置设置
env.put(Context.INITIAL_CONTEXT_FACTORY, LdapCtxFactory.class.getName());
您可以通过将 LdapCtxFactory.class.getName()
替换为限定名称 "com.sun.jndi.ldap.LdapCtxFactory"
来移除对 class 的依赖,即
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
从 Java8 移动到 Java11 后,我收到错误 "package com.sun.jndi.ldap is not visible"。但是我需要这个包用于 Class LdapCtxFactory。包裹是否已移动或我应该为我的 Ldap 连接使用另一个 Class?
此致
因为您对 class LdapCtxFactory
的唯一使用是配置设置
env.put(Context.INITIAL_CONTEXT_FACTORY, LdapCtxFactory.class.getName());
您可以通过将 LdapCtxFactory.class.getName()
替换为限定名称 "com.sun.jndi.ldap.LdapCtxFactory"
来移除对 class 的依赖,即
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");