本帖最后由 o13674976542 于 2018-11-5 10:42 编辑
错误信息: Exception in thread "main" java.lang.NoSuchFieldError: DEFAULT_MR_AM_ADMIN_USER_ENV
package com.zzti.sq.day1101shenmegui.wtf;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
public class ReadHBaseDataMR { private static final String ZK_CONNECT_KEY = "hbase.zookeeper.quorum"; private static final String ZK_CONNECT_VALUE = "master:2181"; private static final String TABLE = "user_info";
public static void main(String[] args) throws Exception { System.setProperty("hadoop.home.dir", "/Users/songqi/RuntimeEnvironment/hadoop-2.7.6HA"); // System.setProperty("HBASE_HOME", "/Users/songqi/RuntimeEnvironment/hbase-1.2.6"); Configuration conf = HBaseConfiguration.create(); conf.set(ZK_CONNECT_KEY, ZK_CONNECT_VALUE); Job job = Job.getInstance(conf); job.setJarByClass(ReadHBaseDataMR.class); // job.setJar("/Users/songqi/Desktop/wtf.jar"); Scan scan = new Scan(); TableMapReduceUtil.initTableMapperJob( TABLE, scan, ReadHbaseDataMR_Mapper.class, Text.class, NullWritable.class, job, false); job.setNumReduceTasks(0); FileOutputFormat.setOutputPath(job, new Path("/hbase_mr/result07")); boolean isDone = job.waitForCompletion(true); System.out.println(isDone); } }
// class TableMapper<KEYOUT, VALUEOUT> // extends Mapper<ImmutableBytesWritable, Result, KEYOUT, VALUEOUT>
mapper类:
package com.zzti.sq.day1101shenmegui.wtf;
import java.io.IOException;
import java.util.List;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.mapreduce.TableMapper;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
public class ReadHbaseDataMR_Mapper extends TableMapper<Text, NullWritable>{
Text outKey = new Text();
@Override
protected void map(ImmutableBytesWritable key,
Result result,
Context context)
throws IOException, InterruptedException {
List<Cell> cells = result.listCells();
for(Cell c: cells){
String rowkey = Bytes.toString(CellUtil.cloneRow(c));
String family = Bytes.toString(CellUtil.cloneFamily(c));
String column = Bytes.toString(CellUtil.cloneQualifier(c));
String value = Bytes.toString(CellUtil.cloneValue(c));
long timestamp = c.getTimestamp();
outKey.set(rowkey + "\t" + family + "\t" + column + "\t" + value + "\t" + timestamp);
context.write(outKey, NullWritable.get());
}
}
}
以下是报错信息:
错误
只有这一点
以下是控制台输出的所有信息 太长发不出来 基本都是这样 只在最后有个错
DEBUG [main] - Call: getFileInfo took 2ms DEBUG [main] - Creating setup context, jobSubmitDir url is scheme: "hdfs" host: "sq" port: 8020 file: "/tmp/hadoop-yarn/staging/songqi/.staging/job_1541197362274_0007" DEBUG [IPC Parameter Sending Thread #0] - IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi sending #22 DEBUG [IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi] - IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi got value #22 DEBUG [main] - Call: getFileInfo took 2ms DEBUG [IPC Parameter Sending Thread #0] - IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi sending #23 DEBUG [IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi] - IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi got value #23 DEBUG [main] - Call: getFileInfo took 2ms INFO [main] - Job jar is not present. Not adding any jar to the list of resources. DEBUG [IPC Parameter Sending Thread #0] - IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi sending #24 DEBUG [IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi] - IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi got value #24 DEBUG [main] - Call: getFileInfo took 2ms DEBUG [IPC Parameter Sending Thread #0] - IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi sending #25 DEBUG [IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi] - IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi got value #25 DEBUG [main] - Call: getFileInfo took 2ms DEBUG [IPC Parameter Sending Thread #0] - IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi sending #26 DEBUG [IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi] - IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi got value #26 DEBUG [main] - Call: getFileInfo took 2ms DEBUG [IPC Parameter Sending Thread #0] - IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi sending #27 DEBUG [IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi] - IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi got value #27 DEBUG [main] - Call: getFileInfo took 2ms DEBUG [main] - Command to launch container for ApplicationMaster is : $JAVA_HOME/bin/java -Djava.io.tmpdir=$PWD/tmp -Dlog4j.configuration=container-log4j.properties -Dyarn.app.container.log.dir=<LOG_DIR> -Dyarn.app.container.log.filesize=0 -Dhadoop.root.logger=INFO,CLA -Dhadoop.root.logfile=syslog -Xmx1024m org.apache.hadoop.mapreduce.v2.app.MRAppMaster 1><LOG_DIR>/stdout 2><LOG_DIR>/stderr INFO [main] - Cleaning up the staging area /tmp/hadoop-yarn/staging/songqi/.staging/job_1541197362274_0007 DEBUG [IPC Parameter Sending Thread #0] - IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi sending #28 DEBUG [IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi] - IPC Client (225290371) connection to master/10.37.129.100:9000 from songqi got value #28 DEBUG [main] - Call: delete took 9ms
Exception in thread "main" java.lang.NoSuchFieldError: DEFAULT_MR_AM_ADMIN_USER_ENV at org.apache.hadoop.mapred.YARNRunner.createApplicationSubmissionContext(YARNRunner.java:480) at org.apache.hadoop.mapred.YARNRunner.submitJob(YARNRunner.java:296) at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:432) at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1285) at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1282) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1614) at org.apache.hadoop.mapreduce.Job.submit(Job.java:1282) at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1303) at com.zzti.sq.day1101shenmegui.wtf.ReadHBaseDataMR.main(ReadHBaseDataMR.java:45) DEBUG [Thread-1] - stopping client from cache: org.apache.hadoop.ipc.Client@341b80b2
求解求解,很奇怪啊 集群我确定也是没问题的
|