hadoop-mapreduce-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raj K Singh <rajkrrsi...@gmail.com>
Subject Re: hadoop java connection problem
Date Fri, 06 Jun 2014 10:51:40 GMT
have you tried to run it through "hadoop jar" instead of directly running
it through the eclipse. it seems problem with your path.

try adding conf-site.xml using conf.addResource(new Path(Vars.HADOOP_HOME
+"/conf/core-site.xml")); before passing the conf reference to the
so that it can identify your filesystem correctly.

Raj K Singh
Mobile  Tel: +91 (0)9899821370

On Fri, Jun 6, 2014 at 3:49 PM, Ekta Agrawal <ektacloudstack@gmail.com>

> Hi,
> I am trying to read and write the file from HDFS.I am trying to read it
> and display it on console. It runs without giving any error, warning or
> exception but also it is not printing the data from file on console, My
> file is already saved in hdfs , I can see it on user interface. I think
> there is some problem with the path I have given, I am not sure as I am
> connecting hadoop first time to java .I am using eclipse as IDE. Can
> somebody look into this?
> Code:
> Path pt=new Path("hdfs://localhost:54310/user/hduser/project11/a.txt");
>  FileSystem fs = FileSystem.get(new Configuration());
>   BufferedReader br=new BufferedReader(new InputStreamReader(fs.open(pt)));
>    String line;
>                 while (( line=br.readLine()) != null){
>                                 System.out.println(line);
>                                 line=br.readLine();
>                         }
>  if anybody has some idea of this. Please Share.
> Regards,
> Ekta

View raw message