-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
8, 11
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
Any OS (not OS-specific), Java 8 and Java 11.
A DESCRIPTION OF THE PROBLEM :
If you have created a LdapDnsProvider which resolves hostnames from an LDAP URL and an exception occurs, there is no way to obtain the actual/real hostname from the NamingException:
DirContext c = (DirContext) e.getResolvedObj();
c.getEnvironment()
java.naming.provider.url in the environment will only contain the original URL, not those resolved by the LdapDnsProvider. There is com.sun.jndi.ldap.domainname which contains the domain name, not a hostname. The internal LdapClient stores the hostname, but is inaccessible.
If you want to log the exception there is no way to log the actual failed hostname which makes analysis really really hard.
The RFE is to add the properties: com.sun.jndi.ldap.hostname and/or com.sun.jndi.ldap.address to the environment.
com.sun.jndi.ldap.hostname: the actual hostname the LDAP connection has been established to.
com.sun.jndi.ldap.address: the actual address hostname:port the LDAP connection has been established to. LdapDnsProvider may result in different ports as in the original URL.
This is a non-invasive changes which can be applied to 16, 17, but also 11 and 8. It requires only a few lines of changes in the constructor of LdapCtx.
Any OS (not OS-specific), Java 8 and Java 11.
A DESCRIPTION OF THE PROBLEM :
If you have created a LdapDnsProvider which resolves hostnames from an LDAP URL and an exception occurs, there is no way to obtain the actual/real hostname from the NamingException:
DirContext c = (DirContext) e.getResolvedObj();
c.getEnvironment()
java.naming.provider.url in the environment will only contain the original URL, not those resolved by the LdapDnsProvider. There is com.sun.jndi.ldap.domainname which contains the domain name, not a hostname. The internal LdapClient stores the hostname, but is inaccessible.
If you want to log the exception there is no way to log the actual failed hostname which makes analysis really really hard.
The RFE is to add the properties: com.sun.jndi.ldap.hostname and/or com.sun.jndi.ldap.address to the environment.
com.sun.jndi.ldap.hostname: the actual hostname the LDAP connection has been established to.
com.sun.jndi.ldap.address: the actual address hostname:port the LDAP connection has been established to. LdapDnsProvider may result in different ports as in the original URL.
This is a non-invasive changes which can be applied to 16, 17, but also 11 and 8. It requires only a few lines of changes in the constructor of LdapCtx.