I am trying a write a file to hdfs using scala and I keep getting the following error
Caused by: org.apache.hadoop.ipc.RemoteException: Server IPC version 9
I had the same problem using Hadoop 2.3 and I've solved it adding the following lines to my build.sbt file :
libraryDependencies += "org.apache.hadoop" % "hadoop-client" % "2.3.0"
libraryDependencies += "org.apache.hadoop" % "hadoop-hdfs" % "2.3.0"
So I think in your case you case use the 2.4.0 version.
PS: It also worked on your code sample. I hope it will help