xiboliyalangwolf created HBASE-16406:
----------------------------------------

             Summary: import data to hbase error by using hbase api
                 Key: HBASE-16406
                 URL: https://issues.apache.org/jira/browse/HBASE-16406
             Project: HBase
          Issue Type: Bug
            Reporter: xiboliyalangwolf


  // 添加一条数据
        public static void addRow(String tableName, String row,String 
columnFamily, String column, String value) throws Exception {
            HTable table = new HTable(conf,tableName);
            Put put = new Put(Bytes.toBytes(row));
            put.add(Bytes.toBytes(columnFamily), 
Bytes.toBytes(column),Bytes.toBytes(value));
            table.put(put);
            table.close();
    }
 public static void main(String[] args){
        String tableName = "test1";
        String[] columnFamilys = { "info", "course" };
        //createTable(tableName,columnFamilys);
        try {
                        addRow(tableName, "tht", "info", "age", "20");
//                      addRow(tableName, "tht", "info", "sex", "boy");
                addRow(tableName, "tht", "course", "china", "97");
//              addRow(tableName, "tht", "course", "math", "128");
//              addRow(tableName, "tht", "course", "english", "85");
                } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
The error:
org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException: Failed 1 
action: test1: 1 time, 
        at 
org.apache.hadoop.hbase.client.AsyncProcess$BatchErrors.makeException(AsyncProcess.java:228)
        at 
org.apache.hadoop.hbase.client.AsyncProcess$BatchErrors.access$1700(AsyncProcess.java:208)
        at 
org.apache.hadoop.hbase.client.AsyncProcess.waitForAllPreviousOpsAndReset(AsyncProcess.java:1700)
        at 
org.apache.hadoop.hbase.client.BufferedMutatorImpl.backgroundFlushCommits(BufferedMutatorImpl.java:208)
        at 
org.apache.hadoop.hbase.client.BufferedMutatorImpl.flush(BufferedMutatorImpl.java:183)
        at org.apache.hadoop.hbase.client.HTable.flushCommits(HTable.java:1449)
        at org.apache.hadoop.hbase.client.HTable.put(HTable.java:1040)
        at hbase2.testCreate.addRow(testCreate.java:45)
        at hbase2.testCreate.main(testCreate.java:53)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to