I am a new Hbase user and am trying to figure my way around with the
framework.
I was able to get the cluster going and used map reduce to enter data into
it. Now, I need to access the table from a java program from a client
machine. How can I do that? I tried setting the hbase.master value in the
configuration to the server:port of the hbase master, but that didnt work. I
added the default.xml and site.xml files as resources in the
HBaseConfiguration object, that didnt work either.
This is the error I am getting:
Exception in thread "main" java.lang.IllegalStateException
at java.nio.charset.CharsetEncoder.encode(libgcj.so.90)
at org.apache.hadoop.io.Text.encode(Text.java:388)
at org.apache.hadoop.io.Text.encode(Text.java:369)
at org.apache.hadoop.io.Text.writeString(Text.java:409)
at
org.apache.hadoop.hbase.io.HbaseObjectWritable.writeObject(HbaseObjectWritable.java:265)
at
org.apache.hadoop.hbase.ipc.HBaseRPC$Invocation.write(HBaseRPC.java:156)
at
org.apache.hadoop.hbase.ipc.HBaseClient$Connection.sendParam(HBaseClient.java:472)
at org.apache.hadoop.hbase.ipc.HBaseClient.call(HBaseClient.java:691)
at org.apache.hadoop.hbase.ipc.HBaseRPC$Invoker.invoke(HBaseRPC.java:321)
at $Proxy1.getProtocolVersion(Unknown Source:0)
at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:467)
at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:443)
at org.apache.hadoop.hbase.ipc.HBaseRPC.getProxy(HBaseRPC.java:491)
at org.apache.hadoop.hbase.ipc.HBaseRPC.waitForProxy(HBaseRPC.java:407)
at
org.apache.hadoop.hbase.client.HConnectionManager$TableServers.getHRegionConnection(HConnectionManager.java:724)
at
org.apache.hadoop.hbase.client.HConnectionManager$TableServers.locateRootRegion(HConnectionManager.java:773)
at
org.apache.hadoop.hbase.client.HConnectionManager$TableServers.locateRegion(HConnectionManager.java:448)
at
org.apache.hadoop.hbase.client.HConnectionManager$TableServers.locateRegion(HConnectionManager.java:423)
at
org.apache.hadoop.hbase.client.HConnectionManager$TableServers.locateRegionInMeta(HConnectionManager.java:498)
at
org.apache.hadoop.hbase.client.HConnectionManager$TableServers.locateRegion(HConnectionManager.java:457)
at
org.apache.hadoop.hbase.client.HConnectionManager$TableServers.locateRegion(HConnectionManager.java:423)
at
org.apache.hadoop.hbase.client.HConnectionManager$TableServers.locateRegionInMeta(HConnectionManager.java:498)
at
org.apache.hadoop.hbase.client.HConnectionManager$TableServers.locateRegion(HConnectionManager.java:461)
at
org.apache.hadoop.hbase.client.HConnectionManager$TableServers.locateRegion(HConnectionManager.java:423)
at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:114)
at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:97)
at Client.main(Client.java:21)
What am I doing wrong?
Here's my code for accessing the table:
HBaseConfiguration config = new HBaseConfiguration();
config.set("hbase.master", "rndpc0:60000");
// config.addResource(new
Path("/hadoop/install/hbase/conf/hbase-default.xml"));
// config.addResource(new
Path("/hadoop/install/hbase/conf/hbase-site.xml"));
HTable table = new HTable(config, "sunm");
Cell cell = table.get("842", "disruption:");
String valueStr = Bytes.toString(cell.getValue());
System.out.println(valueStr);
Amandeep
Amandeep Khurana
Computer Science Graduate Student
University of California, Santa Cruz