title: Error when trying to write to hdfs: Server IPC version 9 cannot communicate with client version 4
body: <p>I am trying a write a file to hdfs using scala and I keep getting the following error </p>
  
  <pre><code>Caused by: org.apache.hadoop.ipc.RemoteException: Server IPC version 9 cannot communicate with client version 4
  at org.apache.hadoop.ipc.Client.call(Client.java:1113)
  at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:229)
  at com.sun.proxy.$Proxy1.getProtocolVersion(Unknown Source)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:85)
  at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:62)
  at com.sun.proxy.$Proxy1.getProtocolVersion(Unknown Source)
  at org.apache.hadoop.ipc.RPC.checkVersion(RPC.java:422)
  at org.apache.hadoop.hdfs.DFSClient.createNamenode(DFSClient.java:183)
  at org.apache.hadoop.hdfs.DFSClient.&lt;init&gt;(DFSClient.java:281)
  at org.apache.hadoop.hdfs.DFSClient.&lt;init&gt;(DFSClient.java:245)
  at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:100)
  at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:1446)
  at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:67)
  at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1464)
  at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:263)
  at bcomposes.twitter.Util$.&lt;init&gt;(TwitterStream.scala:39)
  at bcomposes.twitter.Util$.&lt;clinit&gt;(TwitterStream.scala)
  at bcomposes.twitter.StatusStreamer$.main(TwitterStream.scala:17)
  at bcomposes.twitter.StatusStreamer.main(TwitterStream.scala)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  </code></pre>
  
  <p>I installed hadoop following <a href="http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-single-node-cluster/">this tutorial</a>. The code below is what I use to insert a sample file to hdfs.</p>
  
  <pre><code>val configuration = new Configuration();
  val hdfs = FileSystem.get( new URI( "hdfs://192.168.11.153:54310" ), configuration );
  val file = new Path("hdfs://192.168.11.153:54310/s2013/batch/table.html");
  if ( hdfs.exists( file )) { hdfs.delete( file, true ); } 
  val os = hdfs.create( file);
  val br = new BufferedWriter( new OutputStreamWriter( os, "UTF-8" ) );
  br.write("Hello World");
  br.close();
  hdfs.close();
  </code></pre>
  
  <p>The Hadoop version is <strong>2.4.0</strong> and hadoop library version I use is <strong>1.2.1</strong>. What change should I do to make this work?</p>