Return-Path: X-Original-To: apmail-hbase-dev-archive@www.apache.org Delivered-To: apmail-hbase-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C48D51020A for ; Thu, 15 Aug 2013 16:08:12 +0000 (UTC) Received: (qmail 15992 invoked by uid 500); 15 Aug 2013 16:08:09 -0000 Delivered-To: apmail-hbase-dev-archive@hbase.apache.org Received: (qmail 15913 invoked by uid 500); 15 Aug 2013 16:08:08 -0000 Mailing-List: contact dev-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list dev@hbase.apache.org Received: (qmail 15743 invoked by uid 99); 15 Aug 2013 16:08:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Aug 2013 16:08:06 +0000 X-ASF-Spam-Status: No, hits=3.8 required=5.0 tests=FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of yuzhihong@gmail.com designates 209.85.215.52 as permitted sender) Received: from [209.85.215.52] (HELO mail-la0-f52.google.com) (209.85.215.52) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Aug 2013 16:08:00 +0000 Received: by mail-la0-f52.google.com with SMTP id ev20so675822lab.25 for ; Thu, 15 Aug 2013 09:07:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=fJSB/Z6PkgtsKL8scnNjBUJs19DR90zee/jpBmAPZOo=; b=Dc7pOiZ61NFvzNcJVD3v3KlhDM/gpe5HIt7sSoDSqcCimGO2r3KWSFcEo0UGMQRsvZ +H4QzBLUwsxBhoCMZziHV82is7vnlGq0KGpYUdJYQgiaQMUak1+sZk55M/7Ce6m91ifu Jgssg4cROjTvS0vVdyiURZHLofPvKHljgQCCWZs1UKitHpcb0+TCpdPzlX+mGlfMyluU JZxG6TqW47Ir3+sa11jT1WOpd+sJB+OcFdJPlGRGdfgfqfUcjmfgNhInasaieYytM+gK 3sSqdYA9aFDaxe7qlRA4fDtSXB3ycIjd2j/yyoPt5SLx1w6YsrUQMKpG8Fx5n6+bKPic 9osg== MIME-Version: 1.0 X-Received: by 10.112.35.52 with SMTP id e20mr13183965lbj.11.1376582859320; Thu, 15 Aug 2013 09:07:39 -0700 (PDT) Received: by 10.112.129.40 with HTTP; Thu, 15 Aug 2013 09:07:39 -0700 (PDT) In-Reply-To: References: <1376550785757-4049278.post@n3.nabble.com> Date: Thu, 15 Aug 2013 09:07:39 -0700 Message-ID: Subject: Re: Error Running MAP REDUCE Job From: Ted Yu To: "dev@hbase.apache.org" Content-Type: multipart/alternative; boundary=14dae93d970c5573c104e3feac72 X-Virus-Checked: Checked by ClamAV on apache.org --14dae93d970c5573c104e3feac72 Content-Type: text/plain; charset=ISO-8859-1 Nick: Take a look at http://hbase.apache.org/book.html#tools. See '15.1.1. Driver' Cheers On Thu, Aug 15, 2013 at 8:12 AM, Jean-Marc Spaggiari < jean-marc@spaggiari.org> wrote: > Hi Nick, > > Are you really using hbase 0.94.0? We are at 0.94.10. .0 is a pretty old > version. any chance to upgrade? > > Also, what is the output of this command? > ls -hal /opt/hbase/ > ? > > Thanks, > > JM > > 2013/8/15 Nick > > > Hi > > > > I am trying to run a Standalone map reduce job but I am getting > > ClassNotFoundException. > > I am able to connect to shell and create tables, I am also able to scan > > table from stand alone program > > Not sure exactly where I am missing classpath setting > > Will appreciate any advice. > > > > export > > > > > HADOOP_CLASSPATH=/opt/hbase/bin:/opt/hbase/conf:/opt/hbase/hbase-0.94.0.jar:/opt/hbase/hbase-0.94.0-tests.jar > > > > /opt/hadoop/bin/hadoop -jar hbase-example-1.0.jar > > client.MapperTesthuser@gmail.com > > > > Exception in thread "main" java.lang.NoClassDefFoundError: > > org/apache/hadoop/hbase/util/Bytes > > at client.MapperTest.(MapperTest.java:29) > > Caused by: java.lang.ClassNotFoundException: > > org.apache.hadoop.hbase.util.Bytes > > at java.net.URLClassLoader$1.run(URLClassLoader.java:202) > > at java.security.AccessController.doPrivileged(Native Method) > > at java.net.URLClassLoader.findClass(URLClassLoader.java:190) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:306) > > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:247) > > ... 1 more > > > > My Program is like following > > > > package client; > > > > > > import java.io.IOException; > > > > > > import org.apache.hadoop.conf.Configuration; > > import org.apache.hadoop.fs.Path; > > import org.apache.hadoop.hbase.KeyValue; > > import org.apache.hadoop.hbase.client.Result; > > import org.apache.hadoop.hbase.client.Scan; > > import org.apache.hadoop.hbase.io.ImmutableBytesWritable; > > import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil; > > import org.apache.hadoop.hbase.mapreduce.TableMapper; > > import org.apache.hadoop.hbase.util.Bytes; > > import org.apache.hadoop.io.NullWritable; > > import org.apache.hadoop.io.Text; > > import org.apache.hadoop.mapreduce.Job; > > import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; > > import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat; > > > > import util.HBaseHelper; > > > > public class MapperTest { > > > > > > public static String TABLE = "30000001_registration"; > > public static final String COOKIE_ID_QUAL_LABEL = "ci"; > > public static final String REGISTRATION_ID_QUAL_LABEL = "r"; > > public static final byte[] COOKIE_ID_QUAL = > > Bytes.toBytes(COOKIE_ID_QUAL_LABEL); > > public static final byte[] REGISTRATION_ID_QUAL = > > Bytes.toBytes(REGISTRATION_ID_QUAL_LABEL); > > public static final String NAME = "MapperTest"; > > > > > > public static void main(String[] args) throws Exception { > > > > try{ > > Configuration conf = HBaseHelper.getProdQa(); > > Job job = new Job(conf, "Analyze data in " + > > TABLE); > > job.setJarByClass(MapperTest.class); > > Scan scan = new Scan(); > > scan.setCaching(5); > > scan.setCacheBlocks(false); > > > > TableMapReduceUtil.initTableMapperJob(TABLE.getBytes(), scan, > > MyMapper.class,Text.class, NullWritable.class, job); > > //job.setOutputKeyClass(Text.class); > > //job.setOutputValueClass(NullWritable.class); > > job.setNumReduceTasks(0); > > FileOutputFormat.setOutputPath(job, new > > Path("/tmp/nick")); > > job.setOutputFormatClass(TextOutputFormat.class); > > System.exit(job.waitForCompletion(true) ? 0 : 1); > > }catch(Exception e){ > > System.out.println("There is something wrong"); > > } > > > > > > } > > > > static class MyMapper extends TableMapper{ > > > > @Override > > protected void setup(Context context) throws IOException, > > InterruptedException { > > System.out.println("Mapper called"); > > } > > > > @Override > > protected void map(ImmutableBytesWritable key, Result > > columns, > > Context context) throws IOException, > > InterruptedException { > > > > Text text = new Text(); > > NullWritable nullVal = NullWritable.get(); > > > > try { > > for (KeyValue kv : columns.list()) { > > > > > > > if(Bytes.toString(kv.getQualifier()).equalsIgnoreCase(REGISTRATION_ID_QUAL_LABEL)){ > > > > System.out.println(Bytes.toString(kv.getValue())); > > text.set(kv.getValue()); > > context.write(text, nullVal); > > } > > } > > } catch (Exception e) { > > System.out.println("There is something wrong"); > > e.printStackTrace(); > > } > > } > > > > > > > > > > > > } > > > > > > } > > > > > > > > > > > > -- > > View this message in context: > > > http://apache-hbase.679495.n3.nabble.com/Error-Running-MAP-REDUCE-Job-tp4049278.html > > Sent from the HBase Developer mailing list archive at Nabble.com. > > > --14dae93d970c5573c104e3feac72--