【发布时间】:2012-07-20 03:59:44
【问题描述】:
Using DistributedCache in Hadoop by Yavcular
在上面的链接中,以一种易于理解的方式描述了如何在 Hadoop 中使用 DistributedCache。但问题是,当我编译代码时,我得到以下错误:
non-static method loadIdUrlMapping(org.apache.hadoop.mapreduce.Mapper.Context) cannot be referenced from a static context
loadIdUrlMapping(context);
解决方法是什么?我无法将 Mapper 类更改为非静态,当我将 loadIdUrlMapping 方法签名更改为静态时,我无法访问 idmap HashSet
【问题讨论】:
-
您能否发布您的代码版本 - 链接文章中没有
cacheItemset方法 -
抱歉,我刚刚将 loadIdUrlMapping(Context context) 更改为 cacheItemset(Context context)。同样的事情。
标签: hadoop distributed-caching static-classes non-static