HIVE JDBC ThriftHive$Client.sendBase

2019-07-17 04:38发布

i Have work on Hadoop/hive. i have install hadoop and hive which is running fine on command prompt.i have also create a MySQL meta store of hive.I have define HIVE-DB database name in hive-site.xml file.The same name database is available in MySQL>HIVE-DB .but the table which is create on hive command prompt is not available in mysql command Prompt. And when i want to create a hive jdbc Connection then get following error..First it is my Program to create a jdbc connection

package aa;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class Main 
{
     private static String driverName = "org.apache.hadoop.hive.jdbc.HiveDriver";
    public static void main(String args[])
    {
        try {

              Class.forName(driverName);
            } 
        catch (ClassNotFoundException e) 
        {
              // TODO Auto-generated catch block
              e.printStackTrace();
              System.exit(1);
        }
        try
        {
            Connection con = DriverManager.getConnection("jdbc:hive://localhost:10001/default", "", "");
            Statement stmt = con.createStatement();
            String tableName = "recordssss";
            stmt.executeQuery("create table"+tableName+"(id int,name string)");

        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }
}


and then following error is display... because i have start hive as a hive server i.e

**$HIVE_HOME/bin/hive --service hiveserver -p 10001**

xception in thread "main" java.lang.NoSuchMethodError: org.apache.hadoop.hive.service.ThriftHive$Client.sendBase(Ljava/lang/String;Lorg/apache/thrift/TBase;)V
    at org.apache.hadoop.hive.service.ThriftHive$Client.send_execute(ThriftHive.java:110)
    at org.apache.hadoop.hive.service.ThriftHive$Client.execute(ThriftHive.java:102)
    at org.apache.hadoop.hive.jdbc.HiveStatement.executeQuery(HiveStatement.java:187)
    at org.apache.hadoop.hive.jdbc.HiveStatement.execute(HiveStatement.java:127)
    at org.apache.hadoop.hive.jdbc.HiveConnection.configureConnection(HiveConnection.java:126)
    at org.apache.hadoop.hive.jdbc.HiveConnection.<init>(HiveConnection.java:121)
    at org.apache.hadoop.hive.jdbc.HiveDriver.connect(HiveDriver.java:104)
    at java.sql.DriverManager.getConnection(DriverManager.java:620)
    at java.sql.DriverManager.getConnection(DriverManager.java:200)
    at aa.Main.main(Main.java:25)


    enter code here

so pls help me i have describe the problem to you so pls dear anyone help me

1条回答
我命由我不由天
2楼-- · 2019-07-17 04:55

It seems like you are not using appropriate library in your client code. The jars you are using might be of wrong versions. Please check those once.

查看更多
登录 后发表回答