我一直在使用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 {
}
}