hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Yu <yuzhih...@gmail.com>
Subject Re: org.apache.hadoop.hbase.KeyValue not found in gnu.gcj.runtime.SystemClassLoader
Date Thu, 16 Jan 2014 05:32:53 GMT
Which version of HBase are you using ?

Can you tell us how you launched your program ?

Cheers


On Wed, Jan 15, 2014 at 6:48 PM, lei.w@agrant.cn <lei.w@agrant.cn> wrote:

>
> Hi,
>
> I write a simple java class to query the rowkey of a hase table.  It
> compile successfully but meet errors when running it.
>
> Exception in thread "main" java.lang.NoClassDefFoundError: HBaseT
>    at java.lang.Class.initializeClass(libgcj.so.10)
> Caused by: java.lang.ClassNotFoundException:
> org.apache.hadoop.hbase.KeyValue not found in
> gnu.gcj.runtime.SystemClassLoader{urls=[file:./],
> parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
>    at java.net.URLClassLoader.findClass(libgcj.so.10)
>    at java.lang.ClassLoader.loadClass(libgcj.so.10)
>    at java.lang.ClassLoader.loadClass(libgcj.so.10)
>    at java.lang.Class.initializeClass(libgcj.so.10)
>
> Following is my java code:
>
> public class HBaseT {
>     public static Configuration configuration;
>     static {
>         configuration = HBaseConfiguration.create();
>     }
>     public static void main(String[] args) {
>         queryByRowKey("userdigest", "-10000007542109572047");
>     }
>     public static void queryByRowKey(String tableName, String keyName){
>         HTablePool pool = new HTablePool(configuration, 1000);
>         HTableInterface table = (HTableInterface) pool.getTable(tableName);
>         try{
>                 Get get = new Get(Bytes.toBytes(keyName));
>                 get.addFamily(Bytes.toBytes("cf"));
>                 Result r = table.get(get);
>                 System.out.println(r.getRow());
>                 for(KeyValue kv:r.raw()){
>                 System.out.print(new String(kv.getKey()));
>
>                 System.out.println(new String(kv.getValue()));
>             }
>
>         }catch(IOException e){
>                 e.printStackTrace();
>         }
>     }
> }
>
> Any insights on this?
>
> Thanks,
> Lei
>
>
>
> lei.w@agrant.cn

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message