2016-06-24 21 views
0

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections/map/UnmodifiableMap at org.apache.hadoop.conf.Configuration$DeprecationContext.(Configuration.java:398) at org.apache.hadoop.conf.Configuration.(Configuration.java:438) at test.demoMKDIR(test.java:23) at test.main(test.java:36) Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections.map.UnmodifiableMap at java.net.URLClassLoader$1.run(URLClassLoader.java:366) 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:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 4 more取得classnot「は、この私が使用してコードをJavaの

答えて

0
import java.io.BufferedInputStream; 
import java.io.BufferedOutputStream; 
import java.io.File; 
import java.io.FileInputStream; 
import java.io.FileOutputStream; 
import java.io.IOException; 
import java.io.InputStream; 
import java.io.OutputStream; 

import org.apache.hadoop.conf.Configuration; 
import org.apache.hadoop.fs.FSDataInputStream; 
import org.apache.hadoop.fs.FSDataOutputStream; 
import org.apache.hadoop.fs.FileSystem; 
import org.apache.hadoop.fs.Path; 
public class test { 

    /** 
    * @param args 
    * @throws IOException 
    */ 

    public void demoMKDIR(String dir) throws IOException{ 
     Configuration conf = new Configuration(); 
     conf.set("fs.default.name", "hdfs://localhost:8020"); 
     FileSystem fs =FileSystem.get(conf); 

     Path path = new Path(dir); 
     fs.mkdirs(path); 
     System.out.println("directory created"); 
     fs.close(); 

    } 
    public static void main(String[] args) throws Exception { 
     // TODO Auto-generated method stub 
     test t= new test(); 
     t.demoMKDIR("/demodir1"); 
    } 

} 
+0

を使用してHDFSにフォルダを作成しようとしているときに例外を見つけた...私を助けてください –

関連する問題