0
我試圖運行簡單的地圖減少Hadoop的例子,這是我的主要程序:的Hadoop地圖降低不符合番石榴
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和番石榴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嗎? – zsxwing
用番石榴11.0.2試過也沒有發現同樣的例外。 – bigData
你可以在運行時檢查番石榴版本嗎?這[鏈接](http://stackoverflow.com/questions/3222638/get-all-classes-in-classpath)將幫助你獲得你正在使用的類路徑。然後你可以在這裏粘貼classpath。 – zsxwing