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

一 前言


在eclipse中编译调试hive 时出现以下问题

启动clidriver程序在 console执行命令如下

hive> create table xxxx(id int);
create table xxxx(id int);
FAILED: Error in metadata: MetaException(message:file:/user/hive/warehouse/xxxx is not a directory or unable to create one)
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask


日志内容如下

2013-05-14 19:44:12,440 ERROR exec.Task (SessionState.java:printError(401)) - FAILED: Error in metadata: MetaException(message:file:/user/hive/warehouse/xxxx is not a directory or unable to create one)
org.apache.hadoop.hive.ql.metadata.HiveException: MetaException(message:file:/user/hive/warehouse/xxxx is not a directory or unable to create one)
	at org.apache.hadoop.hive.ql.metadata.Hive.createTable(Hive.java:603)
	at org.apache.hadoop.hive.ql.exec.DDLTask.createTable(DDLTask.java:3775)
	at org.apache.hadoop.hive.ql.exec.DDLTask.execute(DDLTask.java:256)
	at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:144)
	at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:57)
	at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:1349)
	at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1135)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:945)
	at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:259)
	at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:216)
	at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:413)
	at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:756)
	at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:614)
Caused by: MetaException(message:file:/user/hive/warehouse/xxxx is not a directory or unable to create one)
	at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.create_table_core(HiveMetaStore.java:1056)
	at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.create_table_with_environment_context(HiveMetaStore.java:1103)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:102)
	at $Proxy9.create_table_with_environment_context(Unknown Source)
	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.createTable(HiveMetaStoreClient.java:466)
	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.createTable(HiveMetaStoreClient.java:455)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:74)
	at $Proxy10.createTable(Unknown Source)
	at org.apache.hadoop.hive.ql.metadata.Hive.createTable(Hive.java:597)
	... 12 more

但是奇怪的是用命令终端运行该命令是正常的

[niy@niy-computer hcatalog]$ hive -e "create table tst1(ll string)"

Logging initialized using configuration in jar:file:/home/niy/workspace1/hive/trunk/lib/hive-common-0.12.0-SNAPSHOT.jar!/hive-log4j.properties
Hive history file=/tmp/niy/hive_job_log_niy_201305141915_62984336.txt
OK
Time taken: 8.554 seconds

二 解决办法


分析 :跟踪源码发现filesystem fs = GetFs(conf); fs 总是LocalFileSystem。实际应该是DistributedFileSystem。


解决办法 是在程序classpath中添加$HADOOP_HOME/conf文件路径 。

参见http://blog.csdn.net/duguduchong/article/details/8991654


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据引用\[1\],错误信息显示无法确定路径是否加密,可能是由于路径不正确导致的。引用\[2\]提到,如果直接将批量文件夹上传到HDFS的路径下,Hive的元数据中不会记录新增的分区数据,需要执行`msck repair db.tablename`命令修复分区。引用\[3\]也提到了修复表分区的情况,当手动复制目录到Hive表的位置下或者频繁导入数据到HDFS时,Hive的元数据可能没有及时更新。因此,可能需要执行`msck repair`命令来修复分区并更新Hive的元数据。 #### 引用[.reference_title] - *1* [Hive -error- 数据仓库问题:FAILED: SemanticException Unable to determine if hdfs://master:9000/user/...](https://blog.csdn.net/li1351026473/article/details/116904190)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [Sparkthrift-sql执行报错-File does not exist: hdfs://xxx/t_bd_materialgroup/xxx.parquet](https://blog.csdn.net/weixin_42151880/article/details/128049960)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值