It does the following in a loop:
a) create initial context.
b) lookup (using object factory)
c) close on initial context
when I run this sequence of actions it works really well,
but if I try to do it 500 times in a loop it will always throw
the following exception for the last few times in the loop:
javax.naming.CommunicationException: netscape.ldap.LDAPException: failed
to connect to server test.mv.sw.com:17193 (91); Cannot connect to the
LDAP server
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at javax.naming.NamingException.<init>(NamingException.java:104)
at javax.naming.CommunicationException.<init>(Compiled Code)
at
com.netscape.jndi.ldap.common.ExceptionMapper.getNamingException(Compiled
Code)
at com.netscape.jndi.ldap.LdapService.connect(Compiled Code)
at com.netscape.jndi.ldap.LdapContextImpl.<init>(Compiled Code)
at
com.netscape.jndi.ldap.LdapContextFactory.getInitialContext(Compiled
Code)
at javax.naming.spi.NamingManager.getInitialContext(Compiled
Code)
at javax.naming.InitialContext.getDefaultInitCtx(Compiled Code)
at javax.naming.InitialContext.init(Compiled Code)
at javax.naming.InitialContext.<init>(Compiled Code)
at javax.naming.directory.InitialDirContext.<init>(Compiled
Code)
This always happends after approx. 490 rounds in the loop !
Could this be a configuration problem ?
Is there some kind of resource that I do not return ?
(close() on initial context is invoked).
Any help would be appreciated,
(I find this really scary)
Håkan
the correct steps should be.
1) create the context (which connects to the server)
2) if you need to perform operations in a loop, do them here.
3) close the context.
you might want to ask on the JNDI list as well, in particular with any code
samples.
Mark