Hive shell在执行查询时抛出Filenotfound异常,尽管使用“ADD JAR”添加了jar文件。 [英] Hive shell throws Filenotfound exception while executing queries, inspite of adding jar files using "ADD JAR"
问题描述
2)创建表
3)表创建成功
4)但是当我执行任何select查询它抛出文件未找到异常
hive>从tab_tweets中选择count(*);
查询ID = hduser_20150604145353_51b4def4-11fb-4638-acac-77301c1c1806
总计工作= 1
启动Job 1 out of 1
编译时确定的减少任务数:1
为了改变reducer的平均负载(以字节为单位):
set hive.exec.reducers.bytes.per.reducer =< number>
为了限制还原器的最大数量:
set hive.exec.reducers.max =< number>
为了设置一个固定数量的简化器:
set mapreduce.job.reduces =< number>
java.io.FileNotFoundException:文件不存在:hdfs:// node1:9000 / home / hduser / softwares / hive / hive-serdes-1.0-SNAPSHOT.jar
at org.apache.hadoop .hdfs.DistributedFileSystem $ 18.doCall(DistributedFileSystem.java:1122)
在org.apache.hadoop.hdfs.DistributedFileSystem $ 18.doCall(DistributedFileSystem.java:1114)
在org.apache.hadoop.fs .FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
在org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:1114)
在org.apache.hadoop.mapreduce.filecache.ClientDistributedCacheManager .getFileStatus(ClientDistributedCacheManager.java:288)
在org.apache.hadoop.mapreduce.filecache.ClientDistributedCacheManager.getFileStatus(ClientDistributedCacheManager.java:224)
在org.apache.hadoop.mapreduce.filecache.ClientDistributedCacheManager .determineTimestamps(ClientDistributedCacheManager.java:99)
at org.apache.hadoop.mapreduce.filecache.ClientDistri butedCacheManager.determineTimestampsAndCacheVisibilities(ClientDistributedCacheManager.java:57)
at org.apache.hadoop.mapreduce.JobSubmitter.copyAndConfigureFiles(JobSubmitter.java:269)
at org.apache.hadoop.mapreduce.JobSubmitter.copyAndConfigureFiles( JobSubmitter.java:390)在org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:483
)
在org.apache.hadoop.mapreduce.Job $ 10.run(Job.java :1296)
at org.apache.hadoop.mapreduce.Job $ 10.run(Job.java:1293)$ b $ at java.security.AccessController.doPrivileged(Native Method)$ b $ javax。 security.auth.Subject.doAs(Subject.java:422)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
at org.apache.hadoop.mapreduce。 Job.submit(Job.java:1293)
在org.apache.hadoop.mapred.JobClient $ 1.run(JobClient.java:562)
在org.apache.hadoop.mapred.JobClient $ 1。在java.security.AccessContro上运行(JobClient.java:557)
ller.doPrivileged(本地方法)
位于javax.security.auth.Subject.doAs(Subject.java:422)
位于org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628 )
at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:557)
at org.apache.hadoop.mapred.JobClient.submitJob(JobClient.java:548)
在org.apache.hadoop.hive.ql.exec.mr.ExecDriver.execute(ExecDriver.java:428)
在org.apache.hadoop.hive.ql.exec.mr.MapRedTask.execute(MapRedTask .java:137)
at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:160)
at org.apache.hadoop.hive.ql.exec.TaskRunner .runSequential(TaskRunner.java:88)
at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:1638)
at org.apache.hadoop.hive.ql.Driver .execute(Driver.java:1397)
at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1183)
at org.apache.hadoop.hive.ql.Driver .run(Driver.java:1049)
在org.apache。 hadoop.hive.ql.Driver.run(Driver.java:1039)
位于org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:207)
位于org.apache。 hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:159)
处org.apache org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:370)
。 hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:754)
在org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:675)
在org.apache。 hadoop.hive.cli.CliDriver.main(CliDriver.java:615)
在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)
在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)
作业提交失败,出现异常'java.io.FileNotFoundException(文件不存在:hdfs:// node1:9000 / home / hduser / softwares / hive / hive-serdes-1.0-SNAPSHOT.jar)'
FAILED:执行错误,从org.apache.hadoop.hive.ql.exec.mr.MapRedTask返回代码1
方法1:将本地文件系统中的 hive-serdes-1.0-SNAPSHOT.jar
文件复制到HDFS中。
hadoop fs -mkdir / home / hduser / software / hive /
hadoop fs -put /home/hduser/softwares/hive/hive-serdes-1.0-SNAPSHOT .jar / home / hduser / software / hive /
注意:如果您使用的是最新的hadoop版本,请使用 hdfs dfs 而不是 hadoop fs 。
方法2 :在中更改
为: hive.aux.jars.path
hive-site.xml
< property>
< name> hive.aux.jars.path< / name>
< value> file:///home/hduser/softwares/hive/hive-serdes-1.0-SNAPSHOT.jar< / value>
< / property>
方法3:添加 hive-serdes- hadoop classpath中的1.0-SNAPSHOT.jar
。即在 hadoop-env.sh
中添加以下行:
export HADOOP_CLASSPATH = $ HADOOP_CLASSPATH:/home/hduser/softwares/hive/hive-serdes-1.0-SNAPSHOT.jar
< blockquote>
注意:我已经提到考虑在 / home / hduser / software / hive 中安装配置单元的路径。如果您的配置单元在别处安装了
,请将 / home / hduser / softwares / hive 更改为
您的配置单元安装文件夹。
1) I have added serde jar file using "ADD JAR /home/hduser/softwares/hive/hive-serdes-1.0-SNAPSHOT.jar;"
2) Create table
3) The table is creates successfully
4) But when I execute any select query it throws file not found exception
hive> select count(*) from tab_tweets;
Query ID = hduser_20150604145353_51b4def4-11fb-4638-acac-77301c1c1806
Total jobs = 1
Launching Job 1 out of 1
Number of reduce tasks determined at compile time: 1
In order to change the average load for a reducer (in bytes):
set hive.exec.reducers.bytes.per.reducer=<number>
In order to limit the maximum number of reducers:
set hive.exec.reducers.max=<number>
In order to set a constant number of reducers:
set mapreduce.job.reduces=<number>
java.io.FileNotFoundException: File does not exist: hdfs://node1:9000/home/hduser/softwares/hive/hive-serdes-1.0-SNAPSHOT.jar
at org.apache.hadoop.hdfs.DistributedFileSystem$18.doCall(DistributedFileSystem.java:1122)
at org.apache.hadoop.hdfs.DistributedFileSystem$18.doCall(DistributedFileSystem.java:1114)
at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
at org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:1114)
at org.apache.hadoop.mapreduce.filecache.ClientDistributedCacheManager.getFileStatus(ClientDistributedCacheManager.java:288)
at org.apache.hadoop.mapreduce.filecache.ClientDistributedCacheManager.getFileStatus(ClientDistributedCacheManager.java:224)
at org.apache.hadoop.mapreduce.filecache.ClientDistributedCacheManager.determineTimestamps(ClientDistributedCacheManager.java:99)
at org.apache.hadoop.mapreduce.filecache.ClientDistributedCacheManager.determineTimestampsAndCacheVisibilities(ClientDistributedCacheManager.java:57)
at org.apache.hadoop.mapreduce.JobSubmitter.copyAndConfigureFiles(JobSubmitter.java:269)
at org.apache.hadoop.mapreduce.JobSubmitter.copyAndConfigureFiles(JobSubmitter.java:390)
at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:483)
at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1296)
at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1293)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
at org.apache.hadoop.mapreduce.Job.submit(Job.java:1293)
at org.apache.hadoop.mapred.JobClient$1.run(JobClient.java:562)
at org.apache.hadoop.mapred.JobClient$1.run(JobClient.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:557)
at org.apache.hadoop.mapred.JobClient.submitJob(JobClient.java:548)
at org.apache.hadoop.hive.ql.exec.mr.ExecDriver.execute(ExecDriver.java:428)
at org.apache.hadoop.hive.ql.exec.mr.MapRedTask.execute(MapRedTask.java:137)
at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:160)
at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:88)
at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:1638)
at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1397)
at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1183)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1049)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1039)
at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:207)
at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:159)
at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:370)
at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:754)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:675)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:615)
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)
Job Submission failed with exception 'java.io.FileNotFoundException(File does not exist: hdfs://node1:9000/home/hduser/softwares/hive/hive-serdes-1.0-SNAPSHOT.jar)' FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask
METHOD 1: Copy hive-serdes-1.0-SNAPSHOT.jar
file from local filesystem to HDFS.
hadoop fs -mkdir /home/hduser/softwares/hive/
hadoop fs -put /home/hduser/softwares/hive/hive-serdes-1.0-SNAPSHOT.jar /home/hduser/softwares/hive/
Note: Use hdfs dfs instead of hadoop fs, if you are using latest hadoop versions.
METHOD 2: Change the value for hive.aux.jars.path
in hive-site.xml
as:
<property>
<name>hive.aux.jars.path</name>
<value>file:///home/hduser/softwares/hive/hive-serdes-1.0-SNAPSHOT.jar</value>
</property>
METHOD 3: Add hive-serdes-1.0-SNAPSHOT.jar
in hadoop classpath. i.e., add this line in hadoop-env.sh
:
export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:/home/hduser/softwares/hive/hive-serdes-1.0-SNAPSHOT.jar
NOTE: I have mentioned the paths considering you have installed hive in /home/hduser/softwares/hive. If you have hive installed elsewhere, please change /home/hduser/softwares/hive to point to your hive installation folder.
这篇关于Hive shell在执行查询时抛出Filenotfound异常,尽管使用“ADD JAR”添加了jar文件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!