将猪将hdfs数据导入hbase时出错

时间:2015-12-18 08:42:11

标签: java hadoop hbase apache-pig

我的群集版本是{hadoop2.7.1,hbase1.1.2,pig0.15} 我尝试通过猪将hdfs数据导入hbase但我发现了问题,错误日志显示如下:

ERROR 1200: Pig script failed to parse:
<file 3hbase.pig, line 4, column 4> pig script failed to validate: java.lang.RuntimeException: could not instantiate 'org.apache.pig.backend.hadoop.hbase.HBaseStorage' with arguments '[gprsinfo:Direction gprsinfo:Latitude gprsinfo:Longitude gprsinfo:Returntime gprsinfo:Speed gprsinfo:Id]'

org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. Pig script failed to parse:
<file 3hbase.pig, line 4, column 4> pig script failed to validate: java.lang.RuntimeException: could not instantiate 'org.apache.pig.backend.hadoop.hbase.HBaseStorage' with arguments '[gprsinfo:Direction gprsinfo:Latitude gprsinfo:Longitude gprsinfo:Returntime gprsinfo:Speed gprsinfo:Id]'
        at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1748)
        at org.apache.pig.PigServer$Graph.access$000(PigServer.java:1443)
        at org.apache.pig.PigServer.parseAndBuild(PigServer.java:387)
        at org.apache.pig.PigServer.executeBatch(PigServer.java:412)
        at org.apache.pig.PigServer.executeBatch(PigServer.java:398)
        at org.apache.pig.tools.grunt.GruntParser.executeBatch(GruntParser.java:171)
        at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:234)
        at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:205)
        at org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:81)
        at org.apache.pig.Main.run(Main.java:631)
        at org.apache.pig.Main.main(Main.java:177)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: Failed to parse: Pig script failed to parse:
<file 3hbase.pig, line 4, column 4> pig script failed to validate: java.lang.RuntimeException: could not instantiate 'org.apache.pig.backend.hadoop.hbase.HBaseStorage' with arguments '[gprsinfo:Direction gprsinfo:Latitude gprsinfo:Longitude gprsinfo:Returntime gprsinfo:Speed gprsinfo:Id]'
        at org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:199)
        at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1735)
        ... 16 more
Caused by:
<file 3hbase.pig, line 4, column 4> pig script failed to validate: java.lang.RuntimeException: could not instantiate 'org.apache.pig.backend.hadoop.hbase.HBaseStorage' with arguments '[gprsinfo:Direction gprsinfo:Latitude gprsinfo:Longitude gprsinfo:Returntime gprsinfo:Speed gprsinfo:Id]'
        at org.apache.pig.parser.LogicalPlanBuilder.buildStoreOp(LogicalPlanBuilder.java:1009)
        at org.apache.pig.parser.LogicalPlanGenerator.store_clause(LogicalPlanGenerator.java:7806)
        at org.apache.pig.parser.LogicalPlanGenerator.op_clause(LogicalPlanGenerator.java:1669)
        at org.apache.pig.parser.LogicalPlanGenerator.general_statement(LogicalPlanGenerator.java:1102)
        at org.apache.pig.parser.LogicalPlanGenerator.statement(LogicalPlanGenerator.java:560)
        at org.apache.pig.parser.LogicalPlanGenerator.query(LogicalPlanGenerator.java:421)
        at org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:191)
        ... 17 more
Caused by: java.lang.RuntimeException: could not instantiate 'org.apache.pig.backend.hadoop.hbase.HBaseStorage' with arguments '[gprsinfo:Direction gprsinfo:Latitude gprsinfo:Longitude gprsinfo:Returntime gprsinfo:Speed gprsinfo:Id]'
        at org.apache.pig.impl.PigContext.instantiateFuncFromSpec(PigContext.java:772)
        at org.apache.pig.parser.LogicalPlanBuilder.buildStoreOp(LogicalPlanBuilder.java:988)
        ... 23 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:422)
        at org.apache.pig.impl.PigContext.instantiateFuncFromSpec(PigContext.java:740)
        ... 24 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:427)
        at org.apache.pig.backend.hadoop.hbase.HBaseStorage.<init>(HBaseStorage.java:368)
        at org.apache.pig.backend.hadoop.hbase.HBaseStorage.<init>(HBaseStorage.java:239)
        ... 29 more

2 个答案:

答案 0 :(得分:0)

Pig仅包含HBase版本的HBase连接器&lt; 1.0(检查Pig的lib目录为您的特定猪版本)以保持hadoop1兼容性。

您必须降级到该版本的HBase,或者从源代码中针对HBase 1.1.2重新编译Pig。

编辑:在此处详细讨论:https://issues.apache.org/jira/browse/PIG-4728

答案 1 :(得分:0)

你可以使用其他版本,这种集成对我有用。

Hadoop 2.5.2, hbase 0.98  猪0.15

我希望你的问题能得到解决