How to ignore trusted certificate in LDAP query
843790Jun 15 2006 — edited Jun 15 2006Hi folks,
When my LDAP code tries to connect to a LDAP server that has a self-signed SSL certificate, it will fail the connection with following exception because the Java does not trust the certificate. Would anybody please tell me if there is a way to tell Java to ignore it? Thanks!
EXCEPTION THROWN : javax.naming.CommunicationException: simple bind failed: 192.168.4.57:636
[Root exception is javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found] at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:198)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2640)
at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:290)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLLdapCtxFactory.java:175)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactor
y.java:193)
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(
LdapCtxFactory.java:66)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
at javax.naming.InitialContext.getDefaultInitC
tx(InitialContext.java:243)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:133)