Hadoop jar packaging and execution problems and solutions

1. Run hadoop jar ./WordCount.jar

A prompt appears:

RunJar jarFile [mainClass] args...

2. Add the mainclass class name at runtime

hadoop jar ./WordCount.jar WCDriver

A prompt appears:

Exception in thread "main" java.lang.ClassNotFoundException: WCDriver
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:214)

        at org.apache.hadoop.util.RunJar.main(RunJar.java:136)

3. Analyze the jar package packaging operation process, and do not specify the class where the main method is located


After specifying the main class, repackage and upload the hadoop server, and execute hadoop jar ./WordCount.jar successfully.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325793320&siteId=291194637