Hi Prajakta,
Awesome!! Thanks for the reply but got one more issue Exception in thread
"main" java.lang.ArrayIndexOutOfBoundsException: 0
    at FileCopy.main(FileCopy.java:17)

On Fri, Jun 22, 2012 at 11:13 AM, Prajakta Kalmegh <pkalm...@gmail.com>wrote:

> Hi Sandeep
>
> I think it has to do with the org.apache.commons.httpclient.URI class you
> are using. Use the create method from java.net.URI instead. I am not sure
> what example is given in the book, but org.apache.commons.httpclient.URI
> does not have a create method.
>
> Hopefully this helps. Let me know.
>
> Regards,
> Prajakta
>
>
> On Fri, Jun 22, 2012 at 8:34 PM, Sandeep Reddy P <
> sandeepreddy.3...@gmail.com> wrote:
>
> > Hi all,
> > I'm using textbook example (page 56) to move data from local file system
> to
> > HDFS. But there is an error in the line FileSystem fs =
> > FileSystem.get(URI.create(dst), conf);
> > Error is the method create string is undefined for the type uri. Please
> > help me with this issue.
> >
> > import java.io.BufferedInputStream;
> > import java.io.FileInputStream;
> > import java.io.InputStream;
> > import java.io.OutputStream;
> >
> > import org.apache.commons.httpclient.URI;
> > import org.apache.hadoop.conf.Configuration;
> > import org.apache.hadoop.fs.FileSystem;
> > import org.apache.hadoop.fs.Path;
> > import org.apache.hadoop.io.IOUtils;
> > import org.apache.hadoop.util.Progressable;
> >
> >
> > public class FileCopy {
> > public static void main(String[] args) throws Exception {
> > String localSrc = args[0];
> > String dst = args[1];
> > InputStream in = new BufferedInputStream(new FileInputStream(localSrc));
> > Configuration conf = new Configuration();
> > FileSystem fs = FileSystem.get(URI.create(dst), conf);
> > OutputStream out = fs.create(new Path(dst), new Progressable() {
> > public void progress() {
> > System.out.print(".");
> > }
> > });
> > IOUtils.copyBytes(in, out, 4096, true);
> > }
> > }
> > --
> > Thanks,
> > sandeep
> >
>



-- 
Thanks,
sandeep

Reply via email to