Wednesday, December 28, 2011

Troubleshooting connectivity issues

Troubleshooting connectivity issues can sometimes be a painful process if we are not aware of how we can get a start up in this area.

Let's take an example to see how we can resolve issues if we come across any.
I was trying to do ldap bind with an existing LDAP server ( Oracle Internet Directory ) on HOST1 ( Windows Server 2008 Enterprise R2).
When I tried doing ldap bind from HOST1 , it worked. But when I tried to do it from some other machine , it gave the connection refused message.


[OIDConnectRegModePage] OID Host Name : HOST1
[OIDConnectRegModePage] OID Port : 3131
[OIDConnectRegModePage] Use SSL Only : true
Setting page validations ..
Verify page validation
Starting validation OIDEXISTS
Validating ..
ERROR - DirContext anonymous bind [ HOST1:3131]
javax.naming.CommunicationException: HOST1:3131 [Root exception is java.net.ConnectException: Connection timed out: connect]
at com.sun.jndi.ldap.Connection.(Connection.java:194)
at com.sun.jndi.ldap.LdapClient.(LdapClient.java:119)
at com.sun.jndi.ldap.LdapClient.getInstance(LdapClient.java:1668)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2599)
at com.sun.jndi.ldap.LdapCtx.(LdapCtx.java:290)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.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.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.ldap.InitialLdapContext.(InitialLdapContext.java:133)
at oracle.ldap.util.jndi.ConnectionUtil.getSSLDirCtx(ConnectionUtil.java:313)
at oracle.ias.randomtool.DirectoryUtils.getDirCtx(DirectoryUtils.java:52)
at oracle.ias.randomtool.DirectoryUtils.getDirCtx(DirectoryUtils.java:61)
at oracle.ias.repca.validation.validateimpl.OIDValidation.validate(OIDValidation.java:140)
at oracle.ias.repca.validation.util.ValidationQueue.performValidations(ValidationQueue.java:276)
at oracle.ias.repca.validation.util.ValidationQueue.run(ValidationQueue.java:211)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.(DashoA12275)
at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(DashoA12275)
at oracle.ias.randomtool.InstallSSLSocketFactoryImpl.createSocket(InstallSSLSocketFactoryImpl.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.jndi.ldap.Connection.createSocket(Connection.java:311)
at com.sun.jndi.ldap.Connection.(Connection.java:181)
... 19 more
ERROR - Closing anonymous DirContext:null
Validation Queue Failed : Unable to locate the specified Directory Server. Please verify that the Directory Server is up and running in the specified Host and Port.



In that case, we need to get to the network layer and see if the port is open or not.
PortQuery is a good tool to troubleshoot connectivity issues. I used the PortQueryUI which is much easier to use.


It showed that the port which I was looking for was not open. So, when I added an exception for the port in Windows firewall using the link here , it worked like a charm



There are other ways by which we can check whether port is open or not.
On Windows 2008 , telnet is not available by default and so , it has to be installed and enabled
After it is enabled , we can do telnet for the host and port from some other machine to see if that port is open or not.

> telnet HOST_NAME PORT_NO

No comments:

Post a Comment