Java.sql.SQLException: org.apache.thrift.transport.TTransportException in the hive?

I am trying to create a table in a hive using java. I found

java.sql.SQLException: org.apache.thrift.transport.TTransportException

while executing my code.

Here is my code

 public void createTable(String tableName) { try{ Statement stat = con.createStatement(); String QueryString = "CREATE TABLE '"+tableName+"'(User_Id INTEGER NOT NULL AUTO_INCREMENT, " + "User_Name VARCHAR(25), UserId VARCHAR(20), User_Pwd VARCHAR(15), primary key(User_Id))"; a = stat.executeUpdate(QueryString); if(a==1){ System.out.println(a); System.out.println("Table has been created"); } }catch(Exception e){ System.out.println(e);} } 

Why is this exception selected and how can I fix it?

+8
java hbase hadoop hive
source share
1 answer

This is a very general error message describing that hiveserver has a problem and offers you a look at the Hive logs. If you access catch logs and find an exception call stack, you can find the root cause or share your exceptional case, I can help you.

The most common problems that I saw as:

  • Concurrency Meta Storage Issues

  • When you start the hive server as $ hive --service yourhiveserver and continue to work for several days and then run your code, it is possible that your connection is a broker on the server and you will get the same error. If you reconnect to the server, this error will disappear. This only happens because after a while, wait_time has expired and shuts down.

  • Port specific errors.

Be sure to configure the open port for your Hive server and install it as shown below before starting the hive server:

  $export HIVE_PORT=10000 $hive --service hiveserver $ _run_your_code 

There may be other reasons, but the best option is to check the call stack in the hive logs for the root cause and fix the problem.

+10
source share

All Articles