Home Forums Hortonworks Sandbox Simple Java HBase example for sandbox 1.3

This topic contains 1 reply, has 1 voice, and was last updated by  Brian Brownlow 1 year, 3 months ago.

  • Creator
    Topic
  • #33300

    Brian Brownlow
    Participant

    hadoop jar MySimpleHBase.jar (as user hbase)

    I am trying to run a simple HBase example via Java on the VM Virtual Box.

    import java.io.IOException;
    import java.util.*;

    import org.apache.hadoop.conf.Configuration;
    import org.apache.hadoop.hbase.HBaseConfiguration;
    import org.apache.hadoop.hbase.client.*;
    import org.apache.hadoop.hbase.util.*;
    import org.apache.hadoop.hbase.HColumnDescriptor;
    import org.apache.hadoop.hbase.HTableDescriptor;
    import org.apache.hadoop.hbase.MasterNotRunningException;
    import org.apache.hadoop.hbase.client.HBaseAdmin;

    public class MySimpleHBase
    {
    public static void main(String args[])
    {
    try { System.out.println(” 0. TRY block1 success!”); }
    catch (Exception e) {System.out.println(“Error on TRY block1″ + e.getMessage());}

    System.out.println(” 1. From program: Hello from MySimpleHBase”);
    System.out.println(” 2. From program: Create a HBase config”);
    try { Configuration config = HBaseConfiguration.create();
    HTable table = new HTable(config, “myLittleHBaseTable”);
    System.out.println(” HBase config object created “); }
    catch (Exception e) {System.out.println(“Error on HBase block” + e.getMessage());}

    }
    }

    I can’t find anything on this error that makes sense. Is there a simple tutorial that can show me a simple HBase java example on the 1.3 sandbox?

    13/08/26 13:28:19 INFO zookeeper.ClientCnxn: Socket connection established to localhost.localdomain/127.0.0.1:2181, initiating session
    13/08/26 13:28:19 INFO zookeeper.ClientCnxn: Session establishment complete on server localhost.localdomain/127.0.0.1:2181, sessionid = 0x140bc06105c0018, negotiated timeout = 40000
    13/08/26 13:28:19 ERROR zookeeper.ZooKeeperNodeTracker: Check the value configured in ‘zookeeper.znode.parent’. There could be a mismatch with the one configured in the master.
    Error on HBase blockCheck the value configured in ‘zookeeper.znode.parent’. There could be a mismatch with the one configured in the master.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.

  • Author
    Replies
  • #33304

    Brian Brownlow
    Participant

    I finally got an example to work! It was related to my classpath.

    Collapse
Viewing 1 replies (of 1 total)