首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网络技术 > 网络协议 >

hadoop jar 提醒 Not a valid JAR

2013-11-09 
hadoop jar 提示Not a valid JAR1. 编译 WordCount.java2. 打成 WordCount.jar包 上传的hdfs。。3. hadoop j

hadoop jar 提示 Not a valid JAR
1. 编译 WordCount.java  
2. 打成 WordCount.jar包 上传的hdfs。。
3. hadoop jar WordCount.jar ***.**.MainClass /**/input /***/output

问题一直提示  Not a valid JAR: /usr/***/***/wordcount.jar
hadoop Not?a?valid?JAR
[解决办法]

引用:
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop dfs -copyFromLocal /home/hadoop/hadoop/test/wordcount/input/docs/fair_scheduler.html wordcount/input/file1
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop dfs -copyFromLocal /home/hadoop/hadoop/test/wordcount/wordcount/jar wordcount/wordcount.jar
copyFromLocal: File /home/hadoop/hadoop/test/wordcount/wordcount/jar does not exist.
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop dfs -copyFromLocal /home/hadoop/hadoop/test/wordcount/wordcount.jar wordcount/wordcount.jar
copyFromLocal: File /home/hadoop/hadoop/test/wordcount/wordcount.jar does not exist.
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop dfs -copyFromLocal /home/long/Downloads/hadoop/test/wordcount.jar wordcount/wordcount.jar
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop dfs -ls
Found 1 items
drwxr-xr-x   - hadoop supergroup          0 2013-11-07 20:43 /user/hadoop/wordcount
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop dfs -du wordcount
Found 3 items
47457       hdfs://localhost:9000/user/hadoop/wordcount/input
0           hdfs://localhost:9000/user/hadoop/wordcount/output
4619        hdfs://localhost:9000/user/hadoop/wordcount/wordcount.jar
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop dfs -du wordcount/input/
Found 2 items
10672       hdfs://localhost:9000/user/hadoop/wordcount/input/file0
36785       hdfs://localhost:9000/user/hadoop/wordcount/input/file1
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ bin/hadoop jar wordcount/wordcount.jar com.gilang.handoop.wordcount /usr/hadoop/wordcount/input /usr/hadoop/wordcount/output
bash: bin/hadoop: No such file or directory
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop jar wordcount/wordcount.jar com.gilang.handoop.wordcount /usr/hadoop/wordcount/input /usr/hadoop/wordcount/output
Not a valid JAR: /usr/local/hadoop/bin/wordcount/wordcount.jar
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop jar /usr/hadoop/wordcount/wordcount.jar com.gilang.handoop.wordcount /usr/hadoop/wordcount/input /usr/hadoop/wordcount/output
Not a valid JAR: /usr/hadoop/wordcount/wordcount.jar
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop jar /usr/hadoop/wordcount/wordcount.jar com.gilang.handoop.wordcount.WordCount.class /usr/hadoop/wordcount/input /usr/hadoop/wordcount/output
Not a valid JAR: /usr/hadoop/wordcount/wordcount.jar
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop jar
RunJar jarFile [mainClass] args...
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop jar /usr/hadoop/wordcount/wordcount.jar com.gilang.handoop.wordcount.WordCount.class /usr/hadoop/wordcount/input /usr/hadoop/wordcount/output
Not a valid JAR: /usr/hadoop/wordcount/wordcount.jar
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop dfs -copyFromLocal /home/long/Desktop/wordcount.jar wordcount/wordcount.jar
copyFromLocal: Target wordcount/wordcount.jar already exists
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop dfs -rm wordcount/wordcount.jar
Deleted hdfs://localhost:9000/user/hadoop/wordcount/wordcount.jar
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop dfs -copyFromLocal /home/long/Desktop/wordcount.jar wordcount/wordcount.jar
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop jar /usr/hadoop/wordcount/wordcount.jar com.gilang.handoop.wordcount.WordCount.class /usr/hadoop/wordcount/input /usr/hadoop/wordcount/output
Not a valid JAR: /usr/hadoop/wordcount/wordcount.jar
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop dfs -rm wordcount/wordcount.jarDeleted hdfs://localhost:9000/user/hadoop/wordcount/wordcount.jar
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop dfs -copyFromLocal /home/long/Desktop/wordcount.jar wordcount/wordcount.jarhadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop jar /usr/hadoop/wordcount/wordcount.jar com.gilang.handoop.wordcount.WordCount.class /usr/hadoop/wordcount/input /usr/hadoop/wordcount/output


Not a valid JAR: /usr/hadoop/wordcount/wordcount.jar
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop jar /usr/hadoop/wordcount/wordcount.jar com.gilang.handoop.wordcount.WordCount /usr/hadoop/wordcount/input /usr/hadoop/wordcount/output
\Not a valid JAR: /usr/hadoop/wordcount/wordcount.jar
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop jar /wordcount/wordcount.jar com.gilang.handoop.wordcount.WordCount /usr/hadoop/wordcount/input /usr/hadoop/wordcount/output
Not a valid JAR: /wordcount/wordcount.jar
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop dfs -copyFromLocal /usr/local/hadoop/hadoop-examples-1.2.1.jar wordcount/hadoop-examples-1.2.1.jar
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop jar wordcount/hadoop-examples-1.2.1.jar
Not a valid JAR: /usr/local/hadoop/bin/wordcount/hadoop-examples-1.2.1.jar
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop jar /usr/hadoop/wordcount/hadoop-examples-1.2.1.jar
Not a valid JAR: /usr/hadoop/wordcount/hadoop-examples-1.2.1.jar
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop dfs -rm wordcount/wordcount.jarDeleted hdfs://localhost:9000/user/hadoop/wordcount/wordcount.jar
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop dfs -copyFromLocal /home/long/Desktop/wordcount.jar wordcount/wordcount.jarhadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop jar /wordcount/wordcount.jar com.gilang.handoop.wordcount.WordCount /usr/hadoop/wordcount/input /usr/hadoop/wordcount/output
Not a valid JAR: /wordcount/wordcount.jar
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ ./hadoop jar /usr/hadoop/wordcount/wordcount.jar com.gilang.handoop.wordcount.WordCount.class /usr/hadoop/wordcount/input /usr/hadoop/wordcount/output
Not a valid JAR: /usr/hadoop/wordcount/wordcount.jar
hadoop@long-Aspire-4738ZG:/usr/local/hadoop/bin$ 



你的问题在于,你执行jar包的时候应该是用本地jar包,而不是hdfs上的,所以你写出hdfs路径是不对的。
[解决办法]
你试下这个:
 ./hadoop jar /本地目录/wordcount.jar com.gilang.handoop.wordcount.WordCount.class /usr/hadoop/wordcount/input /usr/hadoop/wordcount/output

热点排行