well, it's worked for me in the past outside Hadoop itself:

http://smartfrog.svn.sourceforge.net/viewvc/smartfrog/trunk/core/hadoop-components/hadoop-ops/src/org/smartfrog/services/hadoop/operations/utils/DfsUtils.java?revision=8882&view=markup

  1. Turn logging up to DEBUG
  2. Make sure that the filesystem you've just loaded is what you expect, by logging its value. It may turn out to be file:///, because the normal Hadoop site-config.xml isn't being picked up
 

On Fri, Aug 31, 2012 at 1:08 AM, Visioner Sadak <visioner.sadak@gmail.com> wrote:
but the problem is that my  code gets executed with the warning but file is not copied to hdfs , actually i m trying to copy a file from local to hdfs
 
   Configuration hadoopConf=new Configuration();
        //get the default associated file system
       FileSystem fileSystem=FileSystem.get(hadoopConf);       
       // HarFileSystem harFileSystem= new HarFileSystem(fileSystem);
        //copy from lfs to hdfs
       fileSystem.copyFromLocalFile(new Path("E:/test/GANI.jpg"),new Path("/user/TestDir/"));