我正在尝试从Windows运行HBase Java客户端程序。 我所拥有的只是1)没有任何编译器错误的Java程序 2)hbase-site.xml (我没有其他HDFS或HBase配置文件。只有上面的那个。) 当我运行程序时,我在最后一个块中得到以下错误。我错过了什么吗? 我都在这里。
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>hbase.zookeeper.quorum</name>
<value>IP Address1,IPAddress2,IPAddress3</value>
</property>
</configuration>
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.util.Bytes;
import java.io.IOException;
public class HConnect
{
public static void main(String[] args)
{
try
{
Configuration aConfig = HBaseConfiguration.create();
HTable aTable = new HTable(aConfig, "TestTable");
byte[] aRowKey = Bytes.toBytes("RowKey1");
Put aPut = new Put(aRowKey);
byte[] aColFamily = Bytes.toBytes("ColumnFamily1");
byte[] aColumn = Bytes.toBytes("Column1");
byte[] aColumnVal = Bytes.toBytes("ColumnValue1");
aPut.add(aColFamily, aColumn, aColumnVal);
aTable.put(aPut);
aTable.close();
}
catch(IOException aException_in)
{
System.out.println("");
}
}
}
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Sep 27, 2013 3:16:13 PM org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper <init>
INFO: The identifier of this process is 7948@sisavip5-600b
Sep 27, 2013 3:16:15 PM org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper retryOrThrow
WARNING: Possibly transient ZooKeeper exception: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid
Sep 27, 2013 3:16:15 PM org.apache.hadoop.hbase.util.RetryCounter sleepUntilNextRetry
INFO: Sleeping 2000ms before retry #1...
Sep 27, 2013 3:16:18 PM org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper retryOrThrow
WARNING: Possibly transient ZooKeeper exception: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid
Sep 27, 2013 3:16:18 PM org.apache.hadoop.hbase.util.RetryCounter sleepUntilNextRetry
INFO: Sleeping 4000ms before retry #2...
Sep 27, 2013 3:16:22 PM org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper retryOrThrow
WARNING: Possibly transient ZooKeeper exception: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid
Sep 27, 2013 3:16:22 PM org.apache.hadoop.hbase.util.RetryCounter sleepUntilNextRetry
INFO: Sleeping 8000ms before retry #3...
Sep 27, 2013 3:16:31 PM org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper retryOrThrow
WARNING: Possibly transient ZooKeeper exception: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid
Sep 27, 2013 3:16:31 PM org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper retryOrThrow
SEVERE: ZooKeeper exists failed after 3 retries
Sep 27, 2013 3:16:31 PM org.apache.hadoop.hbase.zookeeper.ZKUtil checkExists
WARNING: hconnection Unable to set watcher on znode (/hbase/hbaseid)
org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid
答案 0 :(得分:1)
我没有core-site.xml,后来我遇到了一些连接问题 到HDFS名称节点。一旦我解决了这些问题,我就可以插入数据了。
在开发将数据插入HBase的客户端程序时,我解决了以下依赖项: 公共琅2.6 共享记录-1.1.3 SLF4J-1.7.5 protobuf-java-2.4.0a。