title: Unable to start Hive on Mac with mysql
body: <p>I have some trouble upgrading my local development environment on macOS 10.12.3 to Hive with mySQL, as I used a local derby metastore before.</p>
  
  <p>Whenever I start hive, I get the following exceptions:</p>
  
  <pre><code>Exception in thread "main" java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
      at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:578)
      at org.apache.hadoop.hive.ql.session.SessionState.beginStart(SessionState.java:518)
      at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:705)
      at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:641)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
      at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
  Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
      at org.apache.hadoop.hive.ql.metadata.Hive.registerAllFunctionsOnce(Hive.java:226)
      at org.apache.hadoop.hive.ql.metadata.Hive.&lt;init&gt;(Hive.java:366)
      at org.apache.hadoop.hive.ql.metadata.Hive.create(Hive.java:310)
      at org.apache.hadoop.hive.ql.metadata.Hive.getInternal(Hive.java:290)
      at org.apache.hadoop.hive.ql.metadata.Hive.get(Hive.java:266)
      at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:545)
      ... 9 more
  Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
      at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1627)
      at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.&lt;init&gt;(RetryingMetaStoreClient.java:80)
      at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:130)
      at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.getProxy(RetryingMetaStoreClient.java:101)
      at org.apache.hadoop.hive.ql.metadata.Hive.createMetaStoreClient(Hive.java:3317)
      at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:3356)
      at org.apache.hadoop.hive.ql.metadata.Hive.getMSC(Hive.java:3336)
      at org.apache.hadoop.hive.ql.metadata.Hive.getAllFunctions(Hive.java:3590)
      at org.apache.hadoop.hive.ql.metadata.Hive.reloadFunctions(Hive.java:236)
      at org.apache.hadoop.hive.ql.metadata.Hive.registerAllFunctionsOnce(Hive.java:221)
      ... 14 more
  Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
      at org.apache.hadoop.hive.metastore.MetaStoreUtils.newInstance(MetaStoreUtils.java:1625)
      ... 23 more
  Caused by: java.lang.NoSuchMethodError: org.apache.hadoop.tracing.SpanReceiverHost.get(Lorg/apache/hadoop/conf/Configuration;Ljava/lang/String;)Lorg/apache/hadoop/tracing/SpanReceiverHost;
      at org.apache.hadoop.hdfs.DFSClient.&lt;init&gt;(DFSClient.java:634)
      at org.apache.hadoop.hdfs.DFSClient.&lt;init&gt;(DFSClient.java:619)
      at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:149)
      at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2596)
      at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:91)
      at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2630)
      at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2612)
      at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:370)
      at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:169)
      at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:354)
      at org.apache.hadoop.fs.Path.getFileSystem(Path.java:296)
      at org.apache.hadoop.hive.metastore.Warehouse.getFs(Warehouse.java:104)
      at org.apache.hadoop.hive.metastore.Warehouse.getDnsPath(Warehouse.java:140)
      at org.apache.hadoop.hive.metastore.Warehouse.getDnsPath(Warehouse.java:146)
      at org.apache.hadoop.hive.metastore.Warehouse.getWhRoot(Warehouse.java:159)
      at org.apache.hadoop.hive.metastore.Warehouse.getDefaultDatabasePath(Warehouse.java:177)
      at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultDB_core(HiveMetaStore.java:588)
      at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultDB(HiveMetaStore.java:608)
      at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.init(HiveMetaStore.java:398)
      at org.apache.hadoop.hive.metastore.RetryingHMSHandler.&lt;init&gt;(RetryingHMSHandler.java:78)
      at org.apache.hadoop.hive.metastore.RetryingHMSHandler.getProxy(RetryingHMSHandler.java:84)
      at org.apache.hadoop.hive.metastore.HiveMetaStore.newRetryingHMSHandler(HiveMetaStore.java:6396)
      at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.&lt;init&gt;(HiveMetaStoreClient.java:236)
      at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.&lt;init&gt;(SessionHiveMetaStoreClient.java:70)
      ... 28 more
  </code></pre>
  
  <p>Hive is in version 2.10, Hadoop in 2.7.3. namenode and datanode are up and so is mysql, including the correctly initialized metastore database. </p>
  
  <p>Environment variables are set up as such:</p>
  
  <pre><code>➜  ~ echo $HADOOP_HOME
  /usr/local/Cellar/hadoop/2.7.3
  ➜  ~ echo $HIVE_HOME
  /usr/local/Cellar/hive/2.1.0
  ➜  ~ echo $PATH
  /usr/local/Cellar/hadoop/2.7.3/bin:/usr/local/Cellar/spark-2.0.0-bin-hadoop2.7:/usr/local/Cellar/hbase/1.2.2:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Users/christian/bin:/usr/local/Cellar/hive/2.1.0/bin
  </code></pre>
  
  <p>Normal HDFS operations work:</p>
  
  <pre><code>➜  ~ hdfs dfs -ls /
  17/02/26 18:54:44 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
  Found 2 items
  drwx-wx-wx   - christian supergroup          0 2017-02-26 14:15 /tmp
  drwxr-xr-x   - christian supergroup          0 2017-02-26 14:13 /user
  </code></pre>