【问题标题】:hadoop map reduce incompatible with guavahadoop map reduce与guava不兼容
【发布时间】:2015-05-24 04:03:21
【问题描述】:

我正在尝试在 hadoop 中运行简单的 map reduce 示例,这是我的主程序:

    Configuration configuration = new Configuration();

    Job job = new Job(configuration, "conf");
    job.setMapperClass(MapClass.class);

    int numreducers = 1;

    job.setNumReduceTasks(numreducers);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(Text.class);


    FileInputFormat.addInputPath(job, new Path("/user/www/input"));
    FileOutputFormat.setOutputPath(job, new Path("/user/www/output/"));
    System.exit(job.waitForCompletion(true) ? 0 : 1);

我正在使用这些库 hadoop-2.0.0 和 guava 14.0.1,这个程序给出了异常:

Exception in thread "main" java.lang.IncompatibleClassChangeError: class com.google.common.cache.CacheBuilder$3 has interface com.google.common.base.Ticker as super class
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    at com.google.common.cache.CacheBuilder.<clinit>(CacheBuilder.java:190)
    at org.apache.hadoop.hdfs.DomainSocketFactory.<init>(DomainSocketFactory.java:46)
    at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:456)
    at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:410)
    at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:128)
    at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2308)
    at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:87)
    at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2342)
    at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2324)
    at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:351)
    at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:163)
    at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:335)
    at org.apache.hadoop.fs.Path.getFileSystem(Path.java:194)
    at org.apache.hadoop.mapreduce.lib.input.FileInputFormat.addInputPath(FileInputFormat.java:368)

这似乎是库版本不匹配的问题..我该如何解决它。

【问题讨论】:

  • 你能用番石榴11.0.2代替14.0.1吗?
  • 尝试使用 guava 11.0.2 也没有出现同样的异常。
  • 你能在运行时检查番石榴版本吗?这个link 将帮助您获得正在使用的类路径。然后你可以在这里粘贴类路径。

标签: hadoop mapreduce guava


【解决方案1】:

检查此链接可能会对您有所帮助 - click here

而且,如果它没有解决,可能是你的类路径中有多余的番石榴罐导致这个异常。

您能否提供您的 hadoop lib 目录中的文件列表?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-04-04
    • 2012-07-07
    • 2011-07-21
    • 2014-03-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多