hadoop读取文件程序,提示这个Exception in thread main java.lang.ClassNotFoundException:HBaseNewAPI
没有涉及Hbase的操作,HBase开启和关闭都会有这个错误。求大神给解决啊代码如下:packagecom.t1;importorg.apache.hadoop.fs.F...
没有涉及Hbase的操作,HBase开启和关闭都会有这个错误。求大神给解决啊代码如下:package com.t1;import org.apache.hadoop.fs.FsUrlStreamHandlerFactory;import org.apache.hadoop.io.IOUtils;import org.apache.hadoop.fs.FsUrlStreamHandlerFactory;import org.apache.hadoop.io.IOUtils;import java.io.IOException;import java.io.InputStream;import java.net.MalformedURLException;import java.net.URL;public class t1 { static{ URL.setURLStreamHandlerFactory(new FsUrlStreamHandlerFactory()); } public static void main(String[] args) throws MalformedURLException,IOException{ InputStream in=null; try { in=new URL(args[0]).openStream(); IOUtils.copyBytes(in,System.out,4096,false); }finally { IOUtils.closeStream(in); } }}
展开
2个回答
展开全部
Your command line to execute the said class is not correct. You are giving path with folders included. instead you shall give fully qualified class name
[root@dev MapReduce]# hadoop jar target/MapReduce-0.0.1-SNAPSHOT.jar src/main/java/com/hadoop/bi/MapReduce/MaxTemperature sample.txt /out
should be changed to
[root@dev MapReduce]# hadoop jar target/MapReduce-0.0.1-SNAPSHOT.jar com/hadoop/bi/MapReduce/MaxTemperature sample.txt /out
as per your package heirarchy.
Hope this helps.
[root@dev MapReduce]# hadoop jar target/MapReduce-0.0.1-SNAPSHOT.jar src/main/java/com/hadoop/bi/MapReduce/MaxTemperature sample.txt /out
should be changed to
[root@dev MapReduce]# hadoop jar target/MapReduce-0.0.1-SNAPSHOT.jar com/hadoop/bi/MapReduce/MaxTemperature sample.txt /out
as per your package heirarchy.
Hope this helps.
追问
我这是直接在hdfs里面读文件,路径正确,不是路径的原因应该
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这个错是类没找到异常, 仔细查看是不是包导错了
追问
没有导错啊,根本就没有跟这个相关的包啊。我用IntelliJ IDEA远程调用运行好好的,但是打了包之后 master节点上面运行就报这个错误
追答
好吧,,,,,,,,我从没用过你说的intellij ,,,,,,,,,,,,我不能帮到你了
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询