gpt4 book ai didi

Hadoop 1.0.4 分布式缓存错误

转载 作者:可可西里 更新时间:2023-11-01 15:17:37 25 4
gpt4 key购买 nike

我正在 MapReduce 中构建一个日志分析程序。为此,我使用 MaxMind GeoIP 数据。现在我想将 GeoIP 数据放入分布式缓存中。我正在 Eclipse 中开发我的应用程序。这是我正在做的

Job job = new Job();        
DistributedCache.addCacheFile(new URI(args[3]), job.getConfiguration());

其中 args[3] 将具有路径。

我在这里使用它

protected void setup(Context context) {
try {
//String dbfile = "GeoIP//GeoIPCountry.dat";

org.apache.hadoop.conf.Configuration conf = context.getConfiguration();

Path[] dbfile = DistributedCache.getLocalCacheFiles(conf);

// GEOIP_MEMORY_CACHE - load database into memory, faster
// performance but uses more memory, Increase the JVM heap Size
cl = new LookupService(dbfile.toString(), LookupService.GEOIP_MEMORY_CACHE);

} catch (Exception e) {
System.err.println("Error opening GeoIP data file.");
System.err.println(e);
System.exit(2);
}
}

但是在运行时出现以下错误

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
The method addCacheFile(URI, Configuration) in the type DistributedCache is not applicable for the arguments (URI, Configuration)

我无法弄清楚哪里出了问题。请帮忙

最佳答案

它选择了错误的类:

The method addCacheFile(URI, Configuration) in the type DistributedCache is not applicable for the arguments (URI, Configuration)

检查您导入的 URIConfiguration 类。

根据 documentation , 它们应该是 java.net.URIorg.apache.hadoop.conf.Configuration

我想你可能搞砸了 javax.security.auth.login.Configuration来自jdk的类。那不应该在这里使用。

关于Hadoop 1.0.4 分布式缓存错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16829624/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com