Search code examples
hbaseapache-pigemr

In EMR, Pig Script integrated with HBase failing while trying to load data


I am executing a pig script which has an interaction with HBase and I am getting the below error:

Caused by: java.lang.RuntimeException: could not instantiate 'org.apache.pig.backend.hadoop.hbase.HBaseStorage' with arguments at org.apache.pig.impl.PigContext.instantiateFuncFromSpec(PigContext.java:770) at org.apache.pig.parser.LogicalPlanBuilder.buildLoadOp(LogicalPlanBuilder.java:885) ... 38 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.pig.impl.PigContext.instantiateFuncFromSpec(PigContext.java:738) ... 39 more Caused by: java.lang.NoSuchMethodError: org.apache.hadoop.hbase.client.Scan.setCacheBlocks(Z)V at org.apache.pig.backend.hadoop.hbase.HBaseStorage.initScan(HBaseStorage.java:429) at org.apache.pig.backend.hadoop.hbase.HBaseStorage.(HBaseStorage.java:370) ... 44 more

Pig Version : Pig 0.17.0

HBase Version : HBase 1.3.1


Solution

  • There was a Pig 0.16.0 version JAR in the library. So sometimes, when i run a Pig Script in Oozie it picks that version and it connects with HBase 1.x version, which i believe was the reason for the above failure.

    So, i have removed that older JAR file, and now the script which integrates with HBase and runs fine with Pig 0.17 version.