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



[email protected]

Reply via email to