I'm trying to run a simple JUnit test with Hadoop 2.2. on my Windows 7 machine. I have an exemplary test available at http://grepalex.com/2012/10/20/hadoop-unit-testing-with-minimrcluster/ so I'm using ClusterMapReduceTestCase as a base class to start the MiniDFSCluster.
When running the test I'm getting (in console):
2013-11-15 11:59:24,636 ERROR [main] util.Shell (Shell.java:getWinUtilsPath(303)) - Failed to locate the winutils binary in the hadoop binary path java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries. at org.apache.hadoop.util.Shell.getQualifiedBinPath(Shell.java:278) at org.apache.hadoop.util.Shell.getWinUtilsPath(Shell.java:300) at org.apache.hadoop.util.Shell.(Shell.java:293) at org.apache.hadoop.util.StringUtils.(StringUtils.java:76) (...)
and in the JUnit output:
java.lang.UnsatisfiedLinkError: org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Ljava/lang/String;I)Z at org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Native Method) at org.apache.hadoop.io.nativeio.NativeIO$Windows.access(NativeIO.java:435) at org.apache.hadoop.fs.FileUtil.canWrite(FileUtil.java:996) at org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.analyzeStorage(Storage.java:451) at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverStorageDirs(FSImage.java:282) at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:200) (...)
I've read the threads at: Failed to locate the winutils binary in the hadoop binary path and Running Apache Hadoop 2.1.0 on Windows I've also had a look at the possible solutions available at http://www.srccodes.com/p/article/38/build-install-configure-run-apache-hadoop-2.2.0-microsoft-windows-os and http://www.srccodes.com/p/article/39/error-util-shell-failed-locate-winutils-binary-hadoop-binary-path
Unfortunately non of this works in case of JUnit tests. If I write junit tests I want them to be independent of the development environment (so that thye can run without problems on every developer machine). Therefore, I'm using maven and I don't want to build the required libraries on my own and put them in Hadoop bin folder, etc.
Any sugestions what would be the best solution in this case?