You can do the following to determine where the hang is. Here is an example I did to trace it in my broken Jive junction. Please note that this is not a specific solution for any common hanging connection error.
This is the answer to the question: "How can I find out where my connection to JDBC bushes hangs?"
For this, it is difficult to track a dynamic JDBC call. Instead, you can simply create the HiveConnection () class. This allows you to directly add tracing to your code to see where the freeze occurs.
I tracked this by doing the following.
* USING LOG4J *
Sighting and other JDBC hive classes use log4j when connecting, if you enable DEBUG logging, you may see fine-grained errors. You can do it easily by adding
BasicConfigurator.configure()
To your client application. In any case, this led me to conclude that it was like a stall in the SASL transport layer. I suppose this may be related to security, but I would suggest that a security error will return STILL and not hang ... Therefore, I think it might be worthy of JIRA. I inserted the following question:
How to track the rejection of TSaslTransport (associated with the hive)
* ANOTHER METHOD *
1) You can grab a copy of the "HiveConnection" class from github or anywhere and create a new instance:
String url=String.format("jdbc:hive2://%s:%s/default", server, port) Properties p = new Properties(); p.setProperty("host", con); Connection jdbc = new HiveConnection(url,p);
You can then add your debugger hooks or log statements to the HiveConnection () class.
Verbally, when I had this error, I traced it:
openTransport
What ultimately creates
org.apache.thrift.transport.TSaslClientTransport
instance.
And in this code block there is a hang:
try { System.out.println(".....1 carrying on... attempting to open. " + transport.getClass().getName()); transport.open(); System.out.println("done open."); } catch (TTransportException e) { System.out.println("2 fail ."); e.printStackTrace(); throw new SQLException("Could not establish connection to " + uri + ": " + e.getMessage(), " 08S01"); }
FYI I posted information on why the MY connection failed. This may be related to yours ... How to trace the rejection of TSaslTransport (associated with the hive)