import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.conf.Configuration;
import java.io.*;
public class createtable {
public static void main(String[] args)throws IOException {
Configuration con = HBaseConfiguration.create();
HBaseAdmin admin = new HBaseAdmin(con);
HTableDescriptor tableDescriptor = new
HTableDescriptor("emp");
tableDescriptor.addFamily(new HColumnDescriptor("personal"));
tableDescriptor.addFamily(new HColumnDescriptor("professional"));
admin.createTable(tableDescriptor);
System.out.println(" Table created ");
}
}
线程中的异常" main" java.lang.RuntimeException:hbase-default.xml文件似乎是和旧版本的HBase(0.95.2-hadoop2),这个版本是0.95.2-hadoop1
我正在使用eclipse java项目并且还添加了jar文件: hbase-client-0.95.0.jar, hbase-common-0.95.2-hadoop1.jar, hadoop-core-1.1.2.jar, protobuf-java-2.4.1.jar, hbase-protocol-0.95.0.jar, 共享记录-1.2 /共享记录-1.2.jar