Hadoop Java Error : Exception in thread “main” java.lang.NoClassDefFoundError: WordCount (wrong name: org/myorg/WordCount)

前端 未结 6 2472
别那么骄傲
别那么骄傲 2021-02-14 10:42

I am new to hadoop. I followed the maichel-noll tutorial to set up hadoop in single node.I tried running WordCount program. This is the code I used:

import java.         


        
6条回答
  •  逝去的感伤
    2021-02-14 10:57

    The answer of Kishore, allowed me to go in the right direction, if it’s possible i want to confirm this, reporting what I did about an experiiment with java code on moltiplication of sparse matrix :

    1) Source code (downloaded from https://github.com/marufaytekin/MatrixMultiply/tree/master/src/main/java/com/lendap/hadoop), and saved in /home/hduser/playground/src/matrixMult

    2) Downloaded datasets (matrix M and N from https://github.com/marufaytekin/MatrixMultiply/tree/master/input), and then saved in HDFS, with the following path : /user/hduser/inMatrix

    3) Compilation with hadoop classes, with creation of java Classes in playground/classes5 : javac -classpath $HADOOP_HOME/share/hadoop/common/lib/activation-1.1.jar:$HADOOP_HOME/share/hadoop/common/hadoop-common-2.7.1.jar:/usr/hadoop/hadoop-2.7.1/share/hadoop/mapreduce/* -d playground/classes5 playground/src/matrixMult/*

    4) Creation of jar file MatrixMultiply.jar with the following command : jar -cvf playground/MatrixMultiply.jar -C playground/classes5/ .

    5) hadoop mapReduce command (from the $HADOOP_HOME path, that in my case is /usr/hadoop/hadoop-2.7.1$ hadoop jar /home/hduser/playground/MatrixMultiply.jar com.lendap.hadoop.MatrixMultiply /user/hduser/inMatrix/ outputMatrix

    6) Correct execution of mapreduce job on my 4 nodes cluster. Here, part of the final output :

    0,375,890.0 0,376,1005.0 0,377,1377.0 0,378,604.0 0,379,924.0 0,38,476.0 0,380,621.0 0,381,730.0

    990,225,542.0 990,226,639.0 990,227,466.0 990,228,406.0 990,229,343.0 990,23,397.0 990,230,794.0

提交回复
热议问题