title: java.lang.IllegalArgumentException: Wrong FS: , expected: hdfs://localhost:9000
body: <p>I am trying to implement reduce side join , and using mapfile reader to look up distributed cache but it is not looking up the values when checked in stderr it showed the following error, lookupfile file is already present in hdfs , and seems to be loaded correctly into cache as seen in the stdout.</p>
  <blockquote>
  <p>java.lang.IllegalArgumentException: Wrong FS:
  file:/app/hadoop/tmp/mapred/local/taskTracker/distcache/-8118663285704962921_-1196516983_170706299/localhost/input/delivery_status/DeliveryStatusCodes/data,
  expected: hdfs://localhost:9000 at
  org.apache.hadoop.fs.FileSystem.checkPath(FileSystem.java:390) at
  org.apache.hadoop.hdfs.DistributedFileSystem.getPathName(DistributedFileSystem.java:140)
  at
  org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:554)
  at org.apache.hadoop.fs.FileSystem.getLength(FileSystem.java:816) at
  org.apache.hadoop.io.SequenceFile$Reader.(SequenceFile.java:1479) at
  org.apache.hadoop.io.SequenceFile$Reader.(SequenceFile.java:1474) at
  org.apache.hadoop.io.MapFile$Reader.createDataFileReader(MapFile.java:302)
  at org.apache.hadoop.io.MapFile$Reader.open(MapFile.java:284) at
  org.apache.hadoop.io.MapFile$Reader.(MapFile.java:273) at
  org.apache.hadoop.io.MapFile$Reader.(MapFile.java:260) at
  org.apache.hadoop.io.MapFile$Reader.(MapFile.java:253) at
  mr_poc.reducerrsj.initializeDepartmentsMap(reducerrsj.java:59) at
  mr_poc.reducerrsj.setup(reducerrsj.java:42) at
  org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:174) at
  org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:649)
  at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:418) at
  org.apache.hadoop.mapred.Child$4.run(Child.java:255) at
  java.security.AccessController.doPrivileged(Native Method) at
  javax.security.auth.Subject.doAs(Subject.java:416) at
  org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1190)
  at org.apache.hadoop.mapred.Child.main(Child.java:249)
  java.lang.NullPointerException at
  mr_poc.reducerrsj.buildOutputValue(reducerrsj.java:83) at
  mr_poc.reducerrsj.reduce(reducerrsj.java:127) at
  mr_poc.reducerrsj.reduce(reducerrsj.java:1) at
  org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:177) at
  org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:649)
  at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:418) at
  org.apache.hadoop.mapred.Child$4.run(Child.java:255) at
  java.security.AccessController.doPrivileged(Native Method) at
  javax.security.auth.Subject.doAs(Subject.java:416) at
  org.apache.hadoop.security.</p>
  </blockquote>
  <p>This is my driver code ,</p>
  <pre><code>package mr_poc;
  
  import java.net.URI;
  
  import org.apache.hadoop.conf.Configuration;
  import org.apache.hadoop.conf.Configured;
  import org.apache.hadoop.filecache.DistributedCache;
  import org.apache.hadoop.fs.Path;
  import org.apache.hadoop.io.NullWritable;
  import org.apache.hadoop.io.Text;
  import org.apache.hadoop.mapreduce.Job;
  import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
  import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
  import org.apache.hadoop.util.Tool;
  import org.apache.hadoop.util.ToolRunner;
  
  public class driverrsj extends Configured implements Tool{
  
      @Override
      public int run(String[] arg) throws Exception {
  if(arg.length != 3)
  {
      System.out.printf(&quot;3 parameters are required for DriverRSJ- &lt;Input Dir1&gt; &lt;Input Dir2&gt; &lt;Output Dir&gt; \n&quot;);
      return -1;
  }
  Job job = new Job(getConf());
  Configuration conf = job.getConfiguration();
  DistributedCache.addCacheFile(new URI(&quot;/input/delivery_status&quot;), conf);
  System.out.println(&quot;Cache : &quot; + job.getConfiguration().get(&quot;mapred.cache.files&quot;));
  job.setJarByClass(driverrsj.class);
  conf.setInt(&quot;cust_info&quot;, 1);
  conf.setInt(&quot;status&quot;, 2);
  StringBuilder inputPaths = new StringBuilder();
  inputPaths.append(arg[0].toString()).append(&quot;,&quot;).append(arg[1].toString());
  FileInputFormat.setInputPaths(job, inputPaths.toString());
  FileOutputFormat.setOutputPath(job, new Path(arg[2]));
  job.setJarByClass(driverrsj.class);
  job.setMapperClass(mappperRSJ.class);
  job.setReducerClass(reducerrsj.class);
  job.setMapOutputKeyClass(CompositeKeyWritableRSJ.class);
  job.setMapOutputValueClass(Text.class);
  //job.setPartitionerClass(partinonrsj.class);
  job.setSortComparatorClass(secondarysortcomp.class);
  job.setGroupingComparatorClass(GroupingComparatorRSJ.class);
  job.setNumReduceTasks(1);
  job.setOutputKeyClass(NullWritable.class);
  job.setOutputValueClass(Text.class);
  
  
  boolean success =job.waitForCompletion(true);
  return success? 0 : 1;
  
      }
      
      public static void main(String[] args) throws Exception{
          int exitCode = ToolRunner.run(new Configuration(), new driverrsj(),args);
          System.exit(exitCode);
          
      }
      
  
  }
  </code></pre>
  <p>This is my reducer code</p>
  <p>package mr_poc;</p>
  <pre><code>import java.io.File;
  import java.io.IOException;
  import java.net.URI;
  
  import org.apache.hadoop.conf.Configuration;
  import org.apache.hadoop.filecache.DistributedCache;
  import org.apache.hadoop.fs.FileSystem;
  import org.apache.hadoop.fs.Path;
  import org.apache.hadoop.io.MapFile;
  import org.apache.hadoop.io.NullWritable;
  import org.apache.hadoop.io.Text;
  import org.apache.hadoop.mapreduce.Reducer;
  
  public class reducerrsj extends Reducer&lt;CompositeKeyWritableRSJ, Text, NullWritable, Text&gt;{
      StringBuilder reduceValueBuilder = new StringBuilder(&quot;&quot;);
      NullWritable nullWritableKey = NullWritable.get();
      Text reduceOutputValue = new Text(&quot;&quot;);
      String strSeparator = &quot;,&quot;;
      private MapFile.Reader deptMapReader = null;
      Text txtMapFileLookupKey = new Text();
      Text txtMapFileLookupValue = new Text();
      //Path[] cacheFilesLocal;
      //Path[] eachPath;
      
      @Override
      protected void setup(Context context) throws IOException,InterruptedException {
          Path[] cacheFiles = DistributedCache.getLocalCacheFiles(context.getConfiguration());
          
          
          
          for ( Path eachPath : cacheFiles){
              
              System.out.println(eachPath.toString());
                System.out.println(eachPath.getName());
              if(eachPath.getName().toString().contains(&quot;delivery_status&quot;))
              {
                    
                  URI uriUncompressedFile = new File(eachPath.toString()+ &quot;/DeliveryStatusCodes&quot;).toURI();
                  initializeDepartmentsMap(uriUncompressedFile, context);
              
              }
              }
          }
      
      //@SuppressWarnings(&quot;deprecation&quot;)
      private void initializeDepartmentsMap(URI uriUncompressedFile, Context context)
      throws IOException {
      // {{
      // Initialize the reader of the map file (side data)
          Configuration conf = context.getConfiguration();
          conf.addResource(new Path(&quot;/usr/local/hadoop-1.2.1/conf/core-site.xml&quot;));
          FileSystem dfs = FileSystem.get(conf);
      try {
          
          
      deptMapReader = new MapFile.Reader(dfs,uriUncompressedFile.toString(), context.getConfiguration());
      } catch (Exception e) {
      e.printStackTrace();
      }
      // }}
      }
      private StringBuilder buildOutputValue(CompositeKeyWritableRSJ key,
              StringBuilder reduceValueBuilder, Text value) {
               
              if (key.getsourceindex() == 2) {
              
               
              String arrSalAttributes[] = value.toString().split(&quot;,&quot;);
              txtMapFileLookupKey.set(arrSalAttributes[0].toString());
              System.out.println(&quot;key=&quot; + txtMapFileLookupKey);
              
              
              try {
                  
              deptMapReader.get(txtMapFileLookupKey, txtMapFileLookupValue);
              }
               catch (Exception e) {
              txtMapFileLookupValue.set(&quot;&quot;);
                  e.printStackTrace();
              } finally {
              txtMapFileLookupValue
              .set((txtMapFileLookupValue.equals(null) || txtMapFileLookupValue
              .equals(&quot;&quot;)) ? &quot;NOT-FOUND&quot;
              : txtMapFileLookupValue.toString());
              }
          
              reduceValueBuilder.append(txtMapFileLookupValue.toString());
              
               
              } else if(key.getsourceindex() == 1) {
          
              String arrEmpAttributes[] = value.toString().split(&quot;,&quot;);
              reduceValueBuilder.append(arrEmpAttributes[0].toString()).append(
              strSeparator);
              } 
              
               
              
              txtMapFileLookupKey.set(&quot;&quot;);
              txtMapFileLookupValue.set(&quot;&quot;);
              
              return reduceValueBuilder;
      }
       
      @Override
      public void reduce(CompositeKeyWritableRSJ key, Iterable&lt;Text&gt; values,
      Context context) throws IOException, InterruptedException {
       
      
      for (Text value : values) {
      buildOutputValue(key, reduceValueBuilder, value);
      }
       
      // Drop last comma, set value, and emit output
      if (reduceValueBuilder.length() &gt; 1) {
       
      //reduceValueBuilder.setLength(reduceValueBuilder.length() - 1);
      // Emit output
      reduceOutputValue.set(reduceValueBuilder.toString());
      context.write(nullWritableKey, reduceOutputValue);
      } else {
      System.out.println(&quot;Key=&quot; + key.getjoinkey() + &quot;src=&quot;
      + key.getsourceindex());
       
      }
      // Reset variables
      reduceValueBuilder.setLength(0);
      reduceOutputValue.set(&quot;&quot;);
       
      }
      @Override
      protected void cleanup(Context context) throws IOException,
      InterruptedException {
           if(deptMapReader != null)
           {
  deptMapReader.close();
      }
      }
  }
  </code></pre>
  <p>this is my core-site-Xml</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot;?&gt;
  &lt;?xml-stylesheet type=&quot;text/xsl&quot; href=&quot;configuration.xsl&quot;?&gt;
  
  &lt;!-- Put site-specific property overrides in this file. --&gt;
  
  &lt;configuration&gt;
  &lt;property&gt;
    &lt;name&gt;hadoop.tmp.dir&lt;/name&gt;
    &lt;value&gt;/app/hadoop/tmp&lt;/value&gt;
    &lt;description&gt;A base for other temporary directories.&lt;/description&gt;
  &lt;/property&gt;
  &lt;property&gt;
    &lt;name&gt;fs.default.name&lt;/name&gt;
    &lt;value&gt;hdfs://localhost:9000&lt;/value&gt;
    &lt;description&gt;The name of the default file system.  A URI whose
    scheme and authority determine the FileSystem implementation.  The
    uri's scheme determines the config property (fs.SCHEME.impl) naming
    the FileSystem implementation class.  The uri's authority is used to
    determine the host, port, etc. for a filesystem.&lt;/description&gt;
  &lt;/property&gt;
  &lt;/configuration&gt;
  </code></pre>
  <p>Any help would be highly appreciated. Thanks in advance!!!</p>