title: Error: Failed to create Data Storage while running embedded pig in java
body: <p>I wrote a simple program to test the embedded pig in java to run in mapreduce mode.
  The hadoop version in the server I am running is 0.20.2-cdh3u4a, and pig version is 0.10.0-cdh3u4a.</p>
  
  <p>When I try to run in local mode, it runs successfully. But when I try to run in mapreduce mode, it gives me the error.</p>
  
  <p>I run my program using the following commands as shown in <a href="http://pig.apache.org/docs/r0.9.1/cont.html#embed-java" rel="nofollow">http://pig.apache.org/docs/r0.9.1/cont.html#embed-java</a></p>
  
  <pre><code>javac -cp pig.jar EmbedPigTest.java
  javac -cp pig.jar:.:/etc/hadoop/conf EmbedPigTest.java input.txt
  </code></pre>
  
  <p>My program gives error as:</p>
  
  <pre><code>Exception in thread "main" java.lang.RuntimeException: Failed to create DataStorage
          at org.apache.pig.backend.hadoop.datastorage.HDataStorage.init(HDataStorage.java:75)
          at org.apache.pig.backend.hadoop.datastorage.HDataStorage.&lt;init&gt;(HDataStorage.java:58)
          at org.apache.pig.backend.hadoop.executionengine.HExecutionEngine.init(HExecutionEngine.java:214)
          at org.apache.pig.backend.hadoop.executionengine.HExecutionEngine.init(HExecutionEngine.java:134)
          at org.apache.pig.impl.PigContext.connect(PigContext.java:183)
          at org.apache.pig.PigServer.&lt;init&gt;(PigServer.java:226)
          at org.apache.pig.PigServer.&lt;init&gt;(PigServer.java:215)
          at org.apache.pig.PigServer.&lt;init&gt;(PigServer.java:211)
          at org.apache.pig.PigServer.&lt;init&gt;(PigServer.java:207)
          at WordCount.main(EmbedPigTest.java:9)
  </code></pre>
  
  <p>In some online resources they say that this problem occurs due to different hadoop version. But, I didn't understand what I should do. Suggestions please !!</p>