Java 向Hbase表插入数据报(org.apache.hadoop.hbase.client.HTablePool$PooledHTable cannot be cast to org.apac

org.apache.hadoop.hbase.client.HTablePool$PooledHTable cannot be cast to org.apac


Java 向Hbase表插入数据报(org.apache.hadoop.hbase.client.HTablePool$PooledHTable cannot be cast to org.apac

代码:


//1.create HTablePool

HTablePool hp=new HTablePool(con, 1000);

//2.get HTable from HTablepool

HTable ht=(HTable)hp.getTable(tName);


原因:如今应用的api版本中pool.getTable返回的类型是HTableInterface
,无法强转为HTable

Java 向Hbase表插入数据报(org.apache.hadoop.hbase.client.HTablePool$PooledHTable cannot be cast to org.apac


解决办法:

ht.put(put); 换成

hp.getTable(tName).put(put);

上一篇:Markdown语法备忘


下一篇:MySQL数据库的初始化mysql_install_db 【基础巩固】