NoSuchMethodException org.apache.hadoop.yarn.api.records.URL.fromURI
Posted
技术标签:
【中文标题】NoSuchMethodException org.apache.hadoop.yarn.api.records.URL.fromURI【英文标题】: 【发布时间】:2019-01-08 14:08:13 【问题描述】:我正在尝试从 hbase 表中读取数据,对其进行一点处理,然后使用以下代码将其存储在另一个表中
package analysis;
import java.io.IOException;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil;
import org.apache.hadoop.hbase.mapreduce.TableReducer;
import org.apache.hadoop.hbase.mapreduce.TableMapper;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Scan;
public class Author_ref
public static class MyMapper extends TableMapper<Text,Text>
public void map(ImmutableBytesWritable row, Result value,Context context)throws IOException, InterruptedException
String key = new String(row.get());
String values = new String(value.getValue(Bytes.toBytes("authors"), Bytes.toBytes("authors")));
String clean_values = values.replaceAll("[","");
String clean_values2 = clean_values.replaceAll("]","");
String authors[] = clean_values2.trim().split(",");
for (String author : authors)
//Put row = new Put();
context.write(new Text(author),new Text( key));
public static class MyReducer extends TableReducer<Text, Text, ImmutableBytesWritable>
public void reduce(Text author, Iterable<Text> values,Context context)throws IOException,InterruptedException
String papers = "";
for (Text x : values)
papers = papers + ","+x.toString();
Put p = new Put(author.getBytes());
p.add(Bytes.toBytes("papers_writen"),Bytes.toBytes("papers_writen"),Bytes.toBytes(papers));
context.write(null, p);
public static void main(String[] args) throws Exception
Configuration config = HBaseConfiguration.create();
Job job = new Job(config,"ExampleSummary");
Scan scan = new Scan();
scan.setCaching(500); // 1 is the default in Scan, which will be bad for MapReduce jobs
scan.setCacheBlocks(false);
job.setJarByClass(Author_ref.class); // class that contains mapper and reducer
TableMapReduceUtil.initTableMapperJob(
"Dataset", // input table
scan, // Scan instance to control CF and attribute selection
MyMapper.class, // mapper class
Text.class, // mapper output key
Text.class, // mapper output value
job);
TableMapReduceUtil.initTableReducerJob(
"Author_paper", // output table
MyReducer.class, // reducer class
job);
job.setNumReduceTasks(1); // at least one, adjust as required
System.exit(job.waitForCompletion(true)?0:1);
M 出现以下错误..
线程“主”java.lang.NoSuchMethodError 中的异常:org.apache.hadoop.yarn.api.records.URL.fromURI(Ljava/net/URI;)Lorg/apache/hadoop/yarn/api/records/网址; 在 org.apache.hadoop.mapreduce.v2.util.LocalResourceBuilder.createLocalResources(LocalResourceBuilder.java:144) 在 org.apache.hadoop.mapreduce.v2.util.MRApps.setupDistributedCache(MRApps.java:531) 在 org.apache.hadoop.mapred.LocalDistributedCacheManager.setup(LocalDistributedCacheManager.java:92) 在 org.apache.hadoop.mapred.LocalJobRunner$Job.(LocalJobRunner.java:171) 在 org.apache.hadoop.mapred.LocalJobRunner.submitJob(LocalJobRunner.java:760) 在 org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:253) 在 org.apache.hadoop.mapreduce.Job$11.run(Job.java:1570) 在 org.apache.hadoop.mapreduce.Job$11.run(Job.java:1567) 在 java.security.AccessController.doPrivileged(本机方法) 在 javax.security.auth.Subject.doAs(Subject.java:422) 在 org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1889) 在 org.apache.hadoop.mapreduce.Job.submit(Job.java:1567) 在 org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1588) 在 analysis.Author_ref.main(Author_ref.java:111)
我正在使用 hadoop 2.9 和 hbase 1.2.6.1
【问题讨论】:
【参考方案1】:hadoop 2.9和hbase 1.2.x不兼容,看看这个
http://hbase.apache.org/book.html#basic.prerequisites
您必须使用兼容的版本。
【讨论】:
以上是关于NoSuchMethodException org.apache.hadoop.yarn.api.records.URL.fromURI的主要内容,如果未能解决你的问题,请参考以下文章
Spring Boot 2 NoSuchMethodException:org.springframework.mobile.device.Device.<init>()
tomcat启动时报错java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addFilter
tomcat部署项目报错NoSuchMethodException#addServlet,addFilter
NoSuchMethodException org.apache.hadoop.yarn.api.records.URL.fromURI
java.lang.NoSuchMethodException: org.apache.ibatis.executor.statement.StatementHandler.prepare(java.
Caused by: java.lang.NoSuchMethodException: hello.Receiver.receiveMessage([B)