I am trying to create a connection and getMataData() for my local hive server instance (thrift).
Following is the code I am trying:
Class cl = Class.forName("org.apache.hadoop.hive.jdbc.HiveDriver");
Connection conn = DriverManager.getConnection("jdbc:hive://localhost:10000/default", "", "");
DatabaseMetaData data = conn.getMetaData();
System.out.println(data.toString());
But I am getting following Exception:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hive/metastore/api/MetaException at org.apache.hadoop.hive.jdbc.HiveDriver.connect(HiveDriver.java:104) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:185) at my.work.DataSourceConnectionCheck.checkHiveConnection(DataSourceConnectionCheck.java:23) at my.work.DataSourceConnectionCheck.main(DataSourceConnectionCheck.java:67) Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hive.metastore.api.MetaException at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 5 more
Can any one please let me know which jar I missed?