MapReduce Program Operation error Java.lang.ClassNotFoundException solution

Source: Internet
Author: User

When the custom mapper was created, the compilation was correct, but an error occurred while uploading to the cluster execution:

11/16/05 22:53:16INFO mapred. Jobclient:task Id:attempt_201111301626_0015_m_000000_0, status:failedjava.lang.RuntimeException: Java.lang.ClassNotFoundException:actiondemo. Myjob$mapclass at Org.apache.Hadoop.conf.Configuration.getClass (Configuration.java:866) at Org.apache.hadoop.mapreduce.JobContext.getMapperClass (Jobcontext.java:199) at Org.apache.hadoop.mapred.MapTask.runNewMapper (Maptask.java:719) at Org.apache.hadoop.mapred.MapTask.run (Maptask.java:370) at org.apache.hadoop.mapred.child$4.run (child.java:255) at java.security.AccessController.doPrivileged (Native Method) at Javax.security.auth.Subject.doAs (subj Ect.java:396) at Org.apache.hadoop.security.UserGroupInformation.doAs (Usergroupinformation.java:1059) at Org.apache.hadoop.mapred.Child.main (Child.java:249) caused By:java.lang.ClassNotFoundException:actiondemo. Myjob$mapclass at java.net.urlclassloader$1.run (urlclassloader.java:202At java.security.AccessController.doPrivileged (Native Method) at Java.net.URLClassLoader.findClass (URL Classloader.java:190) at Java.lang.ClassLoader.loadClass (Classloader.java:60S) at Sun.misc.launcher$appclassloader.loadclass (Launcher.java:301) at Java.lang.ClassLoader.loadClass (Classloader.java:247At JAVA.LANG.CLASS.FORNAME0 (Native Method) at Java.lang.Class.forName (Class.java:247) at Org.apache.hadoop.conf.Configuration.getClassByName (Configuration.java:819) at Org.apache.hadoop.conf.Configuration.getClass (Configuration.java:864)        ... 8 more

The program development process is developed under Windows Eclipse, and then the jar package is poured out and the jar package is placed on the cluster to run.

The version of the JDK for eclipse cannot be higher than the JDK version configured in Hadoop, or it will be an error. (What type of error, not to be remembered)

  The cause of the problem and the solution are as follows:

Since you are using a Hadoop version of more than 0.20, you need to set the Setjarbyclass method when invoking a custom mapper in the jar, set the method as follows:

  Job.setjarbyclass (Myjob.class);

In fact, in the output log also has the prompt message:
11/16/05 22:53:03 WARN mapred.  Jobclient:no job jar file set. User classes May is not found. See jobconf (Class) or Jobconf#setjar (String).
Job.setjarbyclass (Myjob.class);

MapReduce Program Operation error Java.lang.ClassNotFoundException solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.