Dieter, You don't need to add the default conf location onto the classpath, its pulled out from the hadoop-core jar directly. In fact, another *-default.xml appearing on your classpath somewhere should ring alarm bells. Can you try with just (assuming myjar.jar has the deps bundled here, else one would use 'hadoop jar' to submit):
java -cp /usr/local/hadoop/conf/ -jar myjar.jar On Fri, Aug 26, 2011 at 9:10 PM, Dieter Plaetinck <[email protected]> wrote: > Hi, > I know this question has been asked before, but I could not find > the right solution. Maybe because I use hadoop 0.20.2, some posts assumed > older versions. > > > My code (relevant chunk): > import org.apache.hadoop.conf.Configuration; > import org.apache.hadoop.fs.FileSystem; > Configuration conf = new Configuration(); > FileSystem fs = FileSystem.get(conf); > > the last line gives: > Exception in thread "main" java.io.IOException: No FileSystem for > scheme: file > > > I launched this like so: > java -cp /usr/local/hadoop/src/core/:/usr/local/hadoop/conf/ -jar > myjar.jar > AFAICT, this should make sure all the configuration can be found and it > should be able to connect to the filesystem: > > dplaetin@n-0:~$ ls -alh /usr/local/hadoop/src/core/ /usr/local/hadoop/conf/ > /usr/local/hadoop/conf/: > total 64K > drwxr-xr-x 2 dplaetin Search 4.0K Aug 26 17:21 . > drwxr-xr-x 12 root root 4.0K Feb 19 2010 .. > -rw-rw-r-- 1 root root 3.9K Feb 19 2010 capacity-scheduler.xml > -rw-rw-r-- 1 root root 535 Feb 19 2010 configuration.xsl > -rw-r--r-- 1 dplaetin Search 459 Apr 29 15:06 core-site.xml > -rw-r--r-- 1 dplaetin Search 2.3K Apr 11 14:23 hadoop-env.sh > -rw-rw-r-- 1 root root 1.3K Feb 19 2010 hadoop-metrics.properties > -rw-rw-r-- 1 root root 4.1K Feb 19 2010 hadoop-policy.xml > -rw-r--r-- 1 dplaetin Search 490 Apr 11 10:18 hdfs-site.xml > -rw-r--r-- 1 dplaetin Search 2.8K Apr 11 14:23 log4j.properties > -rw-r--r-- 1 dplaetin Search 1.1K Aug 3 09:49 mapred-site.xml > -rw-rw-r-- 1 root root 10 Feb 19 2010 masters > -rw-r--r-- 1 dplaetin Search 95 Apr 4 17:17 slaves > -rw-rw-r-- 1 root root 1.3K Feb 19 2010 ssl-client.xml.example > -rw-rw-r-- 1 root root 1.2K Feb 19 2010 ssl-server.xml.example > > /usr/local/hadoop/src/core/: > total 36K > drwxr-xr-x 3 root root 4.0K Aug 24 10:40 . > drwxr-xr-x 15 root root 4.0K Aug 24 10:40 .. > -rw-rw-r-- 1 root root 14K Feb 19 2010 core-default.xml > drwxr-xr-x 3 root root 4.0K Feb 19 2010 org > -rw-rw-r-- 1 root root 7.9K Feb 19 2010 overview.html > > Specifically, you can see I have a core-default.xml and a core-site.xml, > which should be all that's needed, > according to the org.apache.hadoop.conf.Configuration documentation > (http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/conf/Configuration.html) > I read somewhere there should be a hadoop-default.xml; I thought this was > deprecated but to be sure I > created the empty file in /usr/local/hadoop/src/core/ , but the error > remained the same. > > The cluster works fine, I've done tens of jobs on it, but as you can see, > something fails when I try to interface to it directly. > > Thanks in advance for any help, > Dieter > > > -- Harsh J
