Yin, Thanks for your response.
It turned out that the problem was caused transitively by the version of Guava. The version I used was 17.0. Switching it back to 14.0.1 fixed the problem. The reason is that some method was public in 14.0.1 but no longer public after 15.0. Hence an IllegalAccessError was thrown, which was eventually translated into failure to instantiate HiveMetaStoreClient. It was discussed by Cheng Lian and Zhun Shen in another thread posted on 8/7/14. Du From: Yin Huai <huaiyin....@gmail.com<mailto:huaiyin....@gmail.com>> Date: Tuesday, August 26, 2014 at 8:58 AM To: Du Li <l...@yahoo-inc.com.invalid<mailto:l...@yahoo-inc.com.invalid>> Cc: "user@spark.apache.org<mailto:user@spark.apache.org>" <user@spark.apache.org<mailto:user@spark.apache.org>> Subject: Re: unable to instantiate HiveMetaStoreClient on LocalHiveContext Hello Du, Can you check if there is a dir "metastore" in the place you launching your program. If so, can you delete it and try again? Also, can you try HiveContext? LocalHiveContext is deprecated. Thanks, Yin On Mon, Aug 25, 2014 at 6:33 PM, Du Li <l...@yahoo-inc.com.invalid<mailto:l...@yahoo-inc.com.invalid>> wrote: Hi, I created an instance of LocalHiveContext and attempted to create a database. However, it failed with message "org.apache.spark.sql.execution.QueryExecutionException: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient”. My code is as follows. Similar code worked on spark-shell and also bin/run-example org.apache.spark.examples.sql.hive.HiveFromSpark. import org.apache.spark.{SparkContext, SparkConf} import org.apache.spark.SparkContext._ import org.apache.spark.sql.hive.LocalHiveContext val conf = new SparkConf(false).setMaster("local").setAppName("test data exchange with Hive") conf.set("spark.driver.host", "localhost") val sc = new SparkContext(conf) val hc = new LocalHiveContext(sc) hc.hql(“create database if not exists testdb") The exception was thrown out of the hql call. Did I miss any configuration? Thanks, Du