繁体   English   中英

Hadoop 1.0.4分布式缓存错误

[英]Hadoop 1.0.4 Distributed Cache Error

我正在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类。

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

我认为您可能已经将jdk中的javax.security.auth.login.Configuration类弄乱了。 那不应该在这里使用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM