Name: gm110360 Date: 08/18/2003
FULL PRODUCT VERSION :
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
FULL OPERATING SYSTEM VERSION :
Linux, kernel 2.2.19, glibc 2.1.3 , based on Debian Potato
EXTRA RELEVANT SYSTEM CONFIGURATION :
LDAP server opposite is OpenLDAP 1.2
A DESCRIPTION OF THE PROBLEM :
Access to OpenLDAP server fails when the server supports
LDAP version 2 only. I observe multiple requests with
version 3 in the server logs instead of first v3, then v2,
as the documentation says.
I've also observed this with network analyzer.
Manually requesting version 2 (java.naming.ldap.version =
"2") does not help: behaviour is the same.
This works ok in J2SE 1.4.0 but not in 1.4.1_01.
REGRESSION. Last worked in version 1.4
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Do Any LDAP-access with JNDI and an LDAP v2 -capable server
EXPECTED VERSUS ACTUAL BEHAVIOR :
1. Observe new InitialLdapContext throwing NamingException
2. Server logs shows multiple requests with version 3.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Dec 16, 2002 2:13:56 PM com.tecnomen.vpu.scfr.LdapSource pollServer
WARNING: error connecting LDAP server 10.3.31.1
javax.naming.CommunicationException: [LDAP: error code 2 - version not supported
]
at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:2965)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2863)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2664)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2578)
at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:275)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:173)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:191
)
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.ja
va:136)
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.jav
a:66)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
62)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243
)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:1
33)
at com.tecnomen.vpu.scfr.LdapSource.pollServer(LdapSource.java:163)
at com.tecnomen.vpu.scfr.LdapConfig.pollServers(LdapConfig.java:201)
at com.tecnomen.vpu.scfr.LdapConfig.<init>(LdapConfig.java:99)
at com.tecnomen.vpu.scfr.SCConfig.parseLdapConfig(SCConfig.java:365)
at com.tecnomen.vpu.scfr.SCConfig.readConfigFromServer(SCConfig.java:239
)
at com.tecnomen.vpu.scfr.SCConfig.<init>(SCConfig.java:107)
at com.tecnomen.vpu.scfr.ServiceComponentImpl.<init>(ServiceComponentImp
l.java:202)
at com.tecnomen.vpu.scfr.ServiceComponentFramework.registerComponentImpl
(ServiceComponentFramework.java:271)
at com.tecnomen.vpu.scfr.ServiceComponentFramework.registerComponent(Ser
viceComponentFramework.java:237)
at com.tecnomen.vpu.ausc.AuSC.main(AuSC.java:98)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Cannot provide you an easy check anyway: you will need a LDAP 2 -only LDAP-server.
Sorry.
This raises the above error (partial code):
env.put(Context.PROVIDER_URL, ldapUrl);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, getBindDn());
env.put(Context.SECURITY_CREDENTIALS, getBindPasswd());
env.put("com.sun.jndi.ldap.connect.timeout",
"" + CONNECTION_TIMEOUT_MSEC);
env.put("java.naming.ldap.version", "2");
InitialLdapContext ctxt = null;
try {
ctxt = new InitialLdapContext(env, new Control[0]);
} catch (NamingException ne) {
logger.log(Level.WARNING,
"error connecting LDAP server " + getHostname(), ne);
throw ne;
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
Update to LDAP v3 in the server if possible (not for me)
(Incident Review ID: 179152)
======================================================================