Home Forums HBase Setting up HBase

Tagged: 

This topic contains 12 replies, has 2 voices, and was last updated by  tedr 1 year, 3 months ago.

  • Creator
    Topic
  • #13536

    V R
    Member

    I am trying to run the sample program of PutExample.java from the book HBase: The Definitive Guide

    I get the following error:

    PutExample.java:5: package org.apache.hadoop.conf does not exist
    import org.apache.hadoop.conf.Configuration;
    ^
    PutExample.java:6: package org.apache.hadoop.hbase does not exist
    import org.apache.hadoop.hbase.HBaseConfiguration;
    ^
    PutExample.java:7: package org.apache.hadoop.hbase.client does not exist
    import org.apache.hadoop.hbase.client.HTable;
    ^
    PutExample.java:8: package org.apache.hadoop.hbase.client does not exist
    import org.apache.hadoop.hbase.client.Put;
    ^
    PutExample.java:9: package org.apache.hadoop.hbase.util does not exist
    import org.apache.hadoop.hbase.util.Bytes;
    ^
    PutExample.java:11: package util does not exist
    import util.HBaseHelper;
    ^
    PutExample.java:19: cannot find symbol
    symbol : class Configuration
    location: class PutExample
    Configuration conf = HBaseConfiguration.create(); // co PutExample-1-CreateConf Create the required configuration.
    ^
    PutExample.java:19: cannot find symbol
    symbol : variable HBaseConfiguration
    location: class PutExample
    Configuration conf = HBaseConfiguration.create(); // co PutExample-1-CreateConf Create the required configuration.
    ^
    PutExample.java:22: cannot find symbol
    symbol : class HBaseHelper
    location: class PutExample
    HBaseHelper helper = HBaseHelper.getHelper(conf);
    ^
    PutExample.java:22: cannot find symbol
    symbol : variable HBaseHelper
    location: class PutExample
    HBaseHelper helper = HBaseHelper.getHelper(conf);
    ^
    PutExample.java:26: cannot find symbol
    symbol : class HTable
    location: class PutExample
    HTable table = new HTable(conf, “testtable”); // co PutExample-2-NewTable Instantiate a new client.
    ^
    PutExample.java:26: cannot find symbol
    symbol : class HTable
    location: class PutExample
    HTable table = new HTable(conf, “testtable”); // co PutExample-2-NewTable Instantiate a new client.
    ^
    PutExample.java:28: cannot find symbol
    symbol : class Put
    location: class PutExample
    Put put = new Put(Bytes.toBytes(“row1″)); // co PutExample-3-NewPut Create put with specific row.
    ^
    PutExample.java:28: cannot find symbol
    symbol : class Put
    location: class PutExample
    Put put = new Put(Bytes.toBytes(“row1″)); // co PutExample-3-NewPut Create put with specific row.
    ^
    PutExample.java:28: cannot find symbol
    symbol : variable Bytes
    location: class PutExample
    Put put = new Put(Bytes.toBytes(“row1″)); // co PutExample-3-NewPut Create put with specific row.
    ^
    PutExample.java:30: cannot find symbol
    symbol : variable Bytes
    location: class PutExample
    put.add(Bytes.toBytes(“colfam1″), Bytes.toBytes(“qual1″),
    ^
    PutExample.java:30: cannot

Viewing 12 replies - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.

  • Author
    Replies
  • #13691

    tedr
    Member

    Hi V R,

    Thanks for letting us know.

    Ted.

    Collapse
    #13662

    V R
    Member

    Issue resolved

    Collapse
    #13560

    tedr
    Member

    Hi V R,

    These errors indicate that there is still something missing from the classpath. Please look in the book to see if they tell you what folders/jars should be added to the classpath. The particular jar that is missing is the one which contains the “HBaseHelper.class”.

    Thanks,
    Ted.

    Collapse
    #13559

    V R
    Member

    Apologies..

    I am using javac to run the code..

    Right now:
    I eliminated the errors I was getting by including the paths in the env variable classpath.

    CLASSPATH=/usr/lib/jvm/j2sdk1.6-oracle/*:/opt/cloudera/parcels/CDH-4.1.2-1.cdh4.1.2.p0.30/lib/hbase/hbase.jar:/opt/cloudera/parcels/CDH-4.1.2-1.cdh4.1.2.p0.30/lib/hbase/*:/opt/cloudera/parcels/CDH-4.1.2-1.cdh4.1.2.p0.30/lib/hadoop/client-0.20/*

    But I get the following 3 errors:

    PutExample.java:15: package util does not exist
    import util.*;
    ^
    PutExample.java:26: cannot find symbol
    symbol : class HBaseHelper
    location: class PutExample
    HBaseHelper helper = HBaseHelper.getHelper(conf);
    ^
    PutExample.java:26: cannot find symbol
    symbol : variable HBaseHelper
    location: class PutExample
    HBaseHelper helper = HBaseHelper.getHelper(conf);
    ^
    3 errors

    Collapse
    #13558

    tedr
    Member

    Hi V R,

    Thank you for the information, but my question was what are you using to compile the code. Are you using “javac …..” on the command line, or are you compiling in an IDE such as Eclipse? the code has to be compiled before you can run it on CDH4 or any other version of Hadoop.

    Thanks,
    Ted.

    Collapse
    #13557

    V R
    Member

    I am using the CDH 4.1.0 distribution on an ubuntu server

    Collapse
    #13543

    tedr
    Member

    Hi V R,

    If you are using Eclipse IDE you add them to the classpath by:
    1) right click on the project int the “package explorer” window
    2) choose “Build Path” from the pop up menu
    3) from the submenu choose “Add external jars”
    4) navigate to and choose the jars.
    It may be necessary to repeat this process to add more than one jar

    if you are using command line compilation do this:
    javac <classname>.java -cp <full/path/to>/hadoopcore.jar,<full/path/to>hadoopexamples.jar (where <classname> is the name of your class and <full/path/to> is the full path to the jar in question)
    NOTE: hadoopcore.jar and hadoopexamples may be named differently on you computer and case is important when specifying classes and jars in java for compilation.

    I hope this helps,
    Ted.

    Collapse
    #13541

    tedr
    Member

    Hi V R,

    How you put these jars on the classpath depends on how you are trying to compile, are you using an IDE, or command line compilation?

    Thanks,
    Ted.

    Collapse
    #13540

    V R
    Member

    I get these errors when I try to compile..

    Collapse
    #13539

    V R
    Member

    How do I add those jars to the classpath?

    Collapse
    #13538

    tedr
    Member

    Hi V R,

    Thank you for trying out Hadoop/HBase on Hortonworks Data Platform.

    Do you get these errors when you are compiling or running? It looks like you haven’t added the hadoop and hadoop examples jars to your classpath.

    I hope this helps,
    Ted.

    Collapse
    #13537

    V R
    Member

    What step(s) am I missing?

    Collapse
Viewing 12 replies - 1 through 12 (of 12 total)