1. 程式人生 > >MetaException(message:file:/user/hive/warehouse/xxx is not a directory or unable to create one)

MetaException(message:file:/user/hive/warehouse/xxx is not a directory or unable to create one)

環境:
hadoop 2.7.6 spark 2.2.0 hive 2.3.3
問題
編寫spark應用儲存資料到hive表,之前不存在該表,報如下錯:

Caused by: MetaException(message:file:/user/hive/warehouse/t_spark_ncdc is not a directory or unable to create one)

原因
原因1: hdfs上對應存放表的目錄沒有相應的許可權,,如/user/hive/warehouse/目錄沒有寫的許可權
原因2:儲存資料到新表時沒有指定資料庫名,預設在default資料庫下建立新表,spark應用無法在default資料庫下建立新表。