我正在尝试在hdfs和Windows计算机中创建文件以测试我的代码。为此,我遵循了此链接HERE,由于它是一个Maven项目,因此与帖子上的Give代码一起使用时效果很好。
我需要在Eclipse中创建一个动态Web项目。我所做的是我将hadoop-client-2.6.1.jar放入了我的项目,但是当它尝试下面的行时,它只是最终最终阻塞了
Configuration configuration = new Configuration();
configuration.set("fs.defaultFS",hdfsUri );
FileSystem fs = FileSystem.get(new URI(sHdfsLandOutPath), configuration);
Path file = new Path(sHdfsLandOutPath + sTableName + ".txt");
我不明白问题出在哪里,因为当我从Windows计算机上运行它时,它没有引发任何错误,而当我通过linux运行它时,出现了以下错误。
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.NoClassDefFoundError: com/google/common/collect/Interners
at org.apache.hadoop.util.StringInterner.<clinit>(StringInterner.java:48)
at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2108)
at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:2001)
at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:1918)
at org.apache.hadoop.conf.Configuration.get(Configuration.java:721)
at org.apache.hadoop.conf.Configuration.getTrimmed(Configuration.java:740)
at org.apache.hadoop.conf.Configuration.getBoolean(Configuration.java:1093)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:363)
at com.jms.demo.JMSConsumer.runConsumer(JMSConsumer.java:115)
at com.jms.demo.JMSConsumer.main(JMSConsumer.java:79)
... 5 more
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.Interners
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)