You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-user@hadoop.apache.org by Mohammad Tariq <do...@gmail.com> on 2012/03/20 05:08:21 UTC
Error while using "listFiles(File dir)"
Hello list,
I am trying to list all the files present in a Hdfs directory using
"listFiles(File dir)", but I am getting the following error -
Exception in thread "main" java.lang.IllegalArgumentException: URI
scheme is not "file"
at java.io.File.<init>(File.java:383)
at filereader2.TransferFileToHDFS.main(TransferFileToHDFS.java:36)
Why is it expecting the scheme not to be "hdfs", even when I am
using the "org.apache.hadoop.fs.FileUtil"??
I am creating a File object using the URI of the hdfs directory in
which all the files, I am trying to list down, are present.May be I am
missing something or committing some mistake.Need some help.Many
thanks.
Regards,
Mohammad Tariq
Re: Error while using "listFiles(File dir)"
Posted by Harsh J <ha...@cloudera.com>.
I don't have your code to tell you exactly where you are going wrong,
but you seem to be using File with hdfs-URIs, which isn't possible
without some further tweaks. Use proper Path objects with
FileUtil.copy* instead?
On Tue, Mar 20, 2012 at 9:38 AM, Mohammad Tariq <do...@gmail.com> wrote:
> Hello list,
>
> I am trying to list all the files present in a Hdfs directory using
> "listFiles(File dir)", but I am getting the following error -
>
> Exception in thread "main" java.lang.IllegalArgumentException: URI
> scheme is not "file"
> at java.io.File.<init>(File.java:383)
> at filereader2.TransferFileToHDFS.main(TransferFileToHDFS.java:36)
>
> Why is it expecting the scheme not to be "hdfs", even when I am
> using the "org.apache.hadoop.fs.FileUtil"??
>
> I am creating a File object using the URI of the hdfs directory in
> which all the files, I am trying to list down, are present.May be I am
> missing something or committing some mistake.Need some help.Many
> thanks.
>
> Regards,
> Mohammad Tariq
--
Harsh J