Java 使用版本0.98.0-hadoop2写入HBase表

Java 使用版本0.98.0-hadoop2写入HBase表,java,mapreduce,hbase,Java,Mapreduce,Hbase,我正在尝试使用HBase版本0.98.0-hadoop2在Java中写入HBase表。在我使用的上一个版本(0.94.x-hadoop1)中,Put实现了可写接口,可以在reducer中使用它以以下方式写入hbase表: Put row = new Put(Bytes.toBytes(unique_row_identifier)); put.add(family_bytes, qualifier_bytes, value_bytes); ... // other put.adds to the

我正在尝试使用HBase版本0.98.0-hadoop2在Java中写入HBase表。在我使用的上一个版本(0.94.x-hadoop1)中,Put实现了可写接口,可以在reducer中使用它以以下方式写入hbase表:

Put row = new Put(Bytes.toBytes(unique_row_identifier));
put.add(family_bytes, qualifier_bytes, value_bytes);
... // other put.adds to the same row
context.write(null, put);\n
当使用升级后的jar(版本0.98.0-hadoop2)时,context.write(null,row)的所有行都会发生错误,消息为“不兼容的类型:Put无法转换为可写”。在做一些研究后,Put对象在版本0.94.0中实现了可写,但在0.98.0中不再实现此接口

是否有其他方法从reducer写入hbase表?是否应使用此版本的hbase

欢迎提出任何建议


谢谢

您是否使用TableOutputFormat作为作业输出格式?在0.94.x中,TableOutputFormat是扩展的OutputFormat。在0.98中,TableOutputFormat是扩展的OutputFormat。So context.write(null,put);应该在0.98中编译良好,因为Put是扩展的。确保您对hbase的依赖是正确的。

正确的情况是这样的,我相信通过改变一些更深层次的依赖性问题,问题已经得到了解决。谢谢,我认为您应该添加/更新一个答案,其中包含供每个人使用的依赖项。我对此问题的解决方案如下:使用Hadoop 2.2.0版。例如hadoop common、hadoop client、hadoop mapreduce client app等都应该是版本2.2.0。使用HBase版本0.98.3-hadoop2。这些改变最终消除了我上面提到的问题,我相信依赖性问题才是问题所在。谢谢你的回复