public class HBase {
static HBaseAdmin admin = null;
static Configuration conf = null;
public static final String HBASE_CONFIGURATION_ZOOKEEPER_QUORUM = "hbase.zookeeper.quorum";
public static final String HBASE_CONFIGURATION_ZOOKEEPER_CLIENTPORT = "hbase.zookeeper.property.clientPort";
public static final String HBASE_HOST = "hdn01.***.com ";
public static final String HBASE_PORT = "2181";
public static void main(String[] args) throws MasterNotRunningException,
ZooKeeperConnectionException {
conf = HBaseConfiguration.create();
conf.clear();
conf.set("hbase.zookeeper.quorum", HBASE_HOST);
conf.set("hbase.zookeeper.property.clientPort", HBASE_PORT);
HTableDescriptor tableDescriptor = new HTableDescriptor("website");
// Adding column families to table descriptor
tableDescriptor.addFamily(new HColumnDescriptor("personal"));
tableDescriptor.addFamily(new HColumnDescriptor("professional"));
System.out.println(" Table creation started ");
try {
HBaseAdmin.checkHBaseAvailable(conf);
admin = new HBaseAdmin(conf);
admin.createTable(tableDescriptor);
} catch (IOException e) {
e.printStackTrace();
}
System.out.println(" Table created ");
}
}
显示以下错误:
Table creation started
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException: Unexpected exception HadoopUser<init>
at org.apache.hadoop.hbase.security.User$HadoopUser.<init>(User.java:275)
at org.apache.hadoop.hbase.security.User$HadoopUser.<init>(User.java:256)
at org.apache.hadoop.hbase.security.User.getCurrent(User.java:159)
at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionKey.<init>(HConnectionManager.java:473)
at org.apache.hadoop.hbase.client.HConnectionManager.getConnection(HConnectionManager.java:199)
at org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:118)
at org.apache.hadoop.hbase.client.HBaseAdmin.checkHBaseAvailable(HBaseAdmin.java:1780)
at HBase.main(HBase.java:45)
Caused by: javax.security.auth.login.LoginException: Login failed: Cannot run program "bash": CreateProcess error=2, The system cannot find the file specified
at org.apache.hadoop.security.UnixUserGroupInformation.login(UnixUserGroupInformation.java:250)
at org.apache.hadoop.security.UnixUserGroupInformation.login(UnixUserGroupInformation.java:275)
at org.apache.hadoop.security.UnixUserGroupInformation.login(UnixUserGroupInformation.java:257)
at org.apache.hadoop.security.UserGroupInformation.login(UserGroupInformation.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.hadoop.hbase.util.Methods.call(Methods.java:37)
at org.apache.hadoop.hbase.security.User.call(User.java:607)
at org.apache.hadoop.hbase.security.User.callStatic(User.java:602)
at org.apache.hadoop.hbase.security.User.access$500(User.java:51)
at org.apache.hadoop.hbase.security.User$HadoopUser.<init>(User.java:265)
暂无答案!
目前还没有任何答案,快来回答吧!