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

Sunday, December 11, 2011

Hostname changed and tnsping not working for Oracle Database server

Let's assume we have Oracle Database server installed on our machine. For some reasons, we had to change the hostname of the machine on which the Oracle db server is installed.

In that case , the tnsping stops working (host1 has been changed to host2 ).

C:\Documents and Settings\amit.upadhyay>tnsping ams

TNS Ping Utility for 32-bit Windows: Version 11.1.0.6.0 - Production on 11-DEC-2
011 17:28:54

Copyright (c) 1997, 2007, Oracle. All rights reserved.

Used parameter files:
C:\app\amit.upadhyay\product\11.1.0\db_1\network\admin\sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = HOST1)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_N
AME = AMS)))
TNS-12545: Connect failed because target host or object does not exist

We come to know that tnsnames.ora has to be changed and we go and change it to host2 but now we get the following error -

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = HOST2)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_N
AME = AMS)))
TNS-12541: TNS:no listener

This means the listener has not started but when we try to start from services , it shows getting started but it doesn't really start. So, to see what is the actual error , open command prompt and go to the location where LSNRCTL.EXE is present -
C:\app\amit.upadhyay\product\11.1.0\db_1\BIN

Type LSNRCTL.EXE

C:\app\amit.upadhyay\product\11.1.0\db_1\BIN>LSNRCTL.EXE

LSNRCTL for 32-bit Windows: Version 11.1.0.6.0 - Production on 11-DEC-2011 17:53
:58

Copyright (c) 1991, 2007, Oracle. All rights reserved.

Welcome to LSNRCTL, type "help" for information.

LSNRCTL>

Enter Start and we will get some error which will point to the actual issue -

LSNRCTL> start
Starting tnslsnr: please wait...

TNSLSNR for 32-bit Windows: Version 11.1.0.6.0 - Production
System parameter file is C:\app\amit.upadhyay\product\11.1.0\db_1\network\admin
listener.ora
Log messages written to c:\app\amit.upadhyay\diag\tnslsnr\inmuml0087\listener\a
ert\log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC152
ipc)))
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=HOST1)(PORT=1521)))
TNS-12545: Connect failed because target host or object does not exist
TNS-12560: TNS:protocol adapter error
TNS-00515: Connect failed because target host or object does not exist
32-bit Windows Error: 1001: Unknown error

Listener failed to start. See the error message(s) above...


It points to listener.ora and when we go and modify the host in this file ( host1 to host2 ) and then try perform start , the tns listener starts successfully.

LSNRCTL can be used from command prompt to debug any issues related to tns listener not starting.





Monday, November 7, 2011

java.sql.SQLException: ORA-01033: ORACLE initialization or shutdown in progress DSRA0010E: SQL State = 08006, Error Code = 1,033

Sometimes , we come across this exception and are not able to connect to the corresponding schema -
java.sql.SQLException: ORA-01033: ORACLE initialization or shutdown in progress
DSRA0010E: SQL State = 08006, Error Code = 1,033

The actual error can be something else -
ORA-00600: internal error code, arguments: [kcratr1_lastbwr], [], [], [], [],
[], [], []

We can find it out by using the following steps -
SQL> select status from v$instance;

the result should be MOUNTED. If so, try
SQL> alter database open;

This will give the actual error. If the error is this -
ORA-00600: internal error code, arguments: [kcratr1_lastbwr], [], [], [], [],
[], [], []

Then follow these steps to fix it -

SQL> startup mount;

Database mounted.

SQL> recover database;

Media recovery complete.


SQL> alter database open;

Database altered.


This should fix the issue.


Tuesday, August 23, 2011

IBM HTTP Server port issues


Many a times , we come across issues where we want to access an application on port 80 and we have IBM HTTP Server as the web server and IBM Websphere Application Server.
By default, we can bypass the webserver and access the application directly through 908x port .
To configure your webserver to handle requests for the application , we need to change plugin-cfg.xml located at : {IBM HTTPServer}\Plugins\config\{webserver name}\plugin-cfg.xml





Saturday, August 20, 2011

VMware Player issue

In case we are using VM Player from our personal WIFI network , then Ethernet Adapter type should be NAT.

Also ,we need to make sure that the following services are started -
VMware DHCP Service ( To obtain dynamic ip )
VMware NAT Service ( To enable to connect to internet or local machine )

Tested on VMPlayer 3.1

Thursday, August 18, 2011

Using Content Engine API for webservices in Websphere Application server

If you are using Content Engine API for webservices in WAS 7 application, then we need to perform following steps in your application -

1. Add the following jar files in classpath -

client-download.jar
stax-api.jar
xlxpScanner.jar
xlxpScannerUtils.jar

2. Make sure the following jar is within the application ear , else we will get ClassNotFoundException: com.ibm.websphere.security.auth.WSSubject

Jace.jar

3. Add the jvm generic argument for jaas.conf.WSI

4. Modify the application to have class loading as (Classes loaded with local class loader first (parent last))

And you should be ready to use the CE API on your WAS application

Tuesday, June 14, 2011

Remote Desktop Client License issue

In case we come across Remote Desktop Client Licensing issue , we need to remove the license entries from registry.
Go to HKEY_LOCAL_MACHINE\Software\Microsoft\MSLicensing
To clean the client's license cache, just delete this key and its subkeys. The next time the client connects to the server, it will obtain another license.



Remove the highlighted entry and you should be able to use remote desktop client now.

Note - Make sure you take a backup before playing with the registry entries.

Reference - http://support.microsoft.com/kb/187614

Tuesday, May 31, 2011

Android USB debugging

How to turn USB debugging ON in Android -

Go to Settings -> Applications -> Development and select the "USB Debugging" checkbox.