After moving from Java8 to Java11, I'm getting the error "package com.sun.jndi.ldap is not visible". But I need this package for the Class LdapCtxFactory. Is the package moved or should I use another Class for my Ldap-Connection?
Best regards
Since your only use of the class LdapCtxFactory is a configuration setup as
env.put(Context.INITIAL_CONTEXT_FACTORY, LdapCtxFactory.class.getName());
you can remove the dependency to the class by replacing LdapCtxFactory.class.getName() with the qualified name "com.sun.jndi.ldap.LdapCtxFactory", i.e.
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With