AnsweredAssumed Answered

Hbase REST is not retuning output from MapR DB

Question asked by shashi.vish on Jul 16, 2015
Latest reply on Aug 25, 2015 by mdameen23
I am trying to query a Mapr table using Hbase rest API.  I started hbase rest services using ./ and wrote a small programm to query my table but it does not seems to be working, But when i am using curl tool to get data from MapR table then it is giving me proper output.Here is my java code that i am using.

     import org.apache.hadoop.conf.Configuration;
    import org.apache.hadoop.hbase.HBaseConfiguration;
    import org.apache.hadoop.hbase.client.Get;
    import org.apache.hadoop.hbase.client.HTable;
    import org.apache.hadoop.hbase.client.HTableInterface;
    import org.apache.hadoop.hbase.client.Result;
    import org.apache.hadoop.hbase.util.Bytes;
    import org.apache.hadoop.hbase.client.Scan;
    public class GetRequest
    public static void main(String[] args) throws IOException
            Cluster cluster = new Cluster();
            cluster.add(hostname, 8081);
            Client client = new Client(cluster);
            RemoteHTable table = new RemoteHTable(client, "/mytesttable");   //Remove forward slash to queyr in hbase table
            Get request = new Get(Bytes.toBytes("metric"));
            request.addColumn(Bytes.toBytes("cf"), Bytes.toBytes("c"));
            Result result = table.get(request);
            System.out.println("Output Returned from Table--->  "+ Bytes.toString( result.getValue(Bytes.toBytes("cf"), Bytes.toBytes("c"))));

Here is my curl command which is returning me a proper output..

    curl -H "Accept: text/xml" http://hostname:8081/%2Fmytesttable/metric/cf:c

Not sure what is wrong here? Can anyone look into it?

Thanks in advance.