我一直在使用HBase的出口实用工具所采取的HBase的表备份。对HBase的出口表thorws运行的MapReduce找不到价值类解串器:“org.apache.hadoop.hbase.client.Result
hbase org.apache.hadoop.hbase.mapreduce.Export "FinancialLineItem" "/project/fricadev/ESGTRF/EXPORT"
这已经踢在mapreduce并将我所有的表数据转移到输出文件夹。 根据该文件,输出文件的文件格式将是序列文件。 所以我跑下面的代码从文件中提取我的密钥和值。
现在我想运行的MapReduce来读取输出文件的键值,但得到的异常以下
java.lang.Exception的:java.io.IOException异常:找不到一个 解串器的价值class: 'org.apache.hadoop.hbase.client.Result'。请确保 配置“io.serializations”的配置是否正确,如果使用自定义序列化是 。 at org.apache.hadoop.mapred.LocalJobRunner $ Job.run(LocalJobRunner.java:406) 引起:java.io.IOException:无法找到Value类的反序列化器:'org.apache.hadoop.hbase .client.Result”。请 确保配置“io.serializations”是正确 配置,如果您正在使用自定义序列化。 at org.apache.hadoop.io.SequenceFile $ Reader.init(SequenceFile.java:1964) at org.apache.hadoop.io.SequenceFile $ Reader.initialize(SequenceFile.java:1811) at org.apache。 hadoop.io.SequenceFile $读者。(SequenceFile.java:1760) 在org.apache.hadoop.io.SequenceFile $读卡器(SequenceFile.java:1774) 在org.apache.hadoop.mapreduce.lib.input。 (org.apache.hadoop.mapred.MapTask.runNewMapper)(MapTask.java: 671) 在org.apache.hadoop.mapred.MapTask.run(MapTask.java:330)
这里是我的驱动程序代码
package SEQ;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
public class SeqDriver extends Configured implements Tool
{
public static void main(String[] args) throws Exception{
int exitCode = ToolRunner.run(new SeqDriver(), args);
System.exit(exitCode);
}
public int run(String[] args) throws Exception {
if (args.length != 2) {
System.err.printf("Usage: %s needs two arguments files\n",
getClass().getSimpleName());
return -1;
}
String outputPath = args[1];
FileSystem hfs = FileSystem.get(getConf());
Job job = new Job();
job.setJarByClass(SeqDriver.class);
job.setJobName("SequenceFileReader");
HDFSUtil.removeHdfsSubDirIfExists(hfs, new Path(outputPath), true);
FileInputFormat.addInputPath(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path(args[1]));
job.setOutputKeyClass(ImmutableBytesWritable.class);
job.setOutputValueClass(Result.class);
job.setInputFormatClass(SequenceFileInputFormat.class);
job.setMapperClass(MySeqMapper.class);
job.setNumReduceTasks(0);
int returnValue = job.waitForCompletion(true) ? 0:1;
if(job.isSuccessful()) {
System.out.println("Job was successful");
} else if(!job.isSuccessful()) {
System.out.println("Job was not successful");
}
return returnValue;
}
}
这里是我的映射器代码
package SEQ;
import java.io.IOException;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
public class MySeqMapper extends Mapper <ImmutableBytesWritable, Result, Text, Text>{
@Override
public void map(ImmutableBytesWritable row, Result value,Context context)
throws IOException, InterruptedException {
}
}