Search code examples
javaldapweblogicweblogic-10.x

LDAP is not connecting weblogic


I am facing issue while authentication with LDAP server. Application code(.ear) is deployed in WebLogic Server.In WebLogic server, code is not connecting with LDAP, and the same code setting is working in the tomcat server without any issue. Note: Sometimes only the first time it is authenticating with WebLogic server. Java version :java version "1.7.0_80" and weblogic server : 10.3.6.0 Keystore is working perfectly and I have tested with simple java program.

System.setProperty("java.naming.ldap.factory.socket", "javax.net.ssl.SSLSocketFactory");
System.setProperty("javax.net.ssl.trustStore","TheKeyStore.keystore");
System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
JSSESocketFactory jsseFactory = new JSSESocketFactory(null);
ld = new LDAPConnection(jsseFactory);
ld.connect(host,port);

Here is the exception i am getting while connecting ldap in weblogic.

netscape.ldap.LDAPException: JSSESocketFactory.makeSocket XXXXXXXXXXXXXXXXXXXXXXXXXXXX:636, Remote host closed connection during handshake (91); Cannot connect to the LDAP server
at netscape.ldap.factory.JSSESocketFactory.makeSocket(Unknown Source)
at netscape.ldap.LDAPConnSetupMgr.connectServer(Unknown Source)
at netscape.ldap.LDAPConnSetupMgr.openSerial(Unknown Source)
at netscape.ldap.LDAPConnSetupMgr.connect(Unknown Source)
at netscape.ldap.LDAPConnSetupMgr.access$000(Unknown Source)
at netscape.ldap.LDAPConnSetupMgr$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)

I have checked TLS protocol and it is not working. Please advice for this issue


Solution

  • As per this question, Java 7 defaults to TLS 1.0, which can cause the error you mention if that protocol is not accepted.