首页 新闻 搜索 专区 学院

Java程序连接Hbase出错,大神帮忙!

0
[待解决问题]

16/09/01 08:43:52 INFO zookeeper.RecoverableZooKeeper: Process identifier=hconnection-0x42f73c55 connecting to ZooKeeper ensemble=server:2181
16/09/01 08:43:52 INFO zookeeper.ZooKeeper: Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT
16/09/01 08:43:52 INFO zookeeper.ZooKeeper: Client environment:host.name=Yield-PC
16/09/01 08:43:52 INFO zookeeper.ZooKeeper: Client environment:java.version=1.7.0_51
16/09/01 08:43:52 INFO zookeeper.ZooKeeper: Client environment:java.vendor=Oracle Corporation
16/09/01 08:43:52 INFO zookeeper.ZooKeeper: Client environment:java.home=C:\Program Files\Java\jdk1.7.0_51\jre
16/09/01 08:43:52 INFO zookeeper.ZooKeeper: Client environment:java.class.path=D:\Java\myeclipse\testSolrHbase\bin;D:\MyEclipse\Common\plugins\org.junit_4.8.2.v4_8_2_v20110321-1705\junit.jar;D:\MyEclipse\Common\plugins\org.hamcrest.core_1.1.0.v20090501071000.jar;D:\Java\myeclipse\testSolrHbase\lib2\activation-1.1.jar;D:\Java\myeclipse\testSolrHbase\lib2\asm-3.1.jar;D:\Java\myeclipse\testSolrHbase\lib2\commons-beanutils-1.7.0.jar;D:\Java\myeclipse\testSolrHbase\lib2\commons-beanutils-core-1.8.0.jar;D:\Java\myeclipse\testSolrHbase\lib2\commons-cli-1.2.jar;D:\Java\myeclipse\testSolrHbase\lib2\commons-codec-1.7.jar;D:\Java\myeclipse\testSolrHbase\lib2\commons-collections-3.2.2.jar;D:\Java\myeclipse\testSolrHbase\lib2\commons-configuration-1.6.jar;D:\Java\myeclipse\testSolrHbase\lib2\commons-digester-1.8.jar;D:\Java\myeclipse\testSolrHbase\lib2\commons-el-1.0.jar;D:\Java\myeclipse\testSolrHbase\lib2\commons-httpclient-3.1.jar;D:\Java\myeclipse\testSolrHbase\lib2\commons-io-2.4.jar;D:\Java\myeclipse\testSolrHbase\lib2\commons-lang-2.6.jar;D:\Java\myeclipse\testSolrHbase\lib2\commons-logging-1.1.1.jar;D:\Java\myeclipse\testSolrHbase\lib2\commons-math-2.1.jar;D:\Java\myeclipse\testSolrHbase\lib2\commons-net-1.4.1.jar;D:\Java\myeclipse\testSolrHbase\lib2\findbugs-annotations-1.3.9-1.jar;D:\Java\myeclipse\testSolrHbase\lib2\guava-12.0.1.jar;D:\Java\myeclipse\testSolrHbase\lib2\hadoop-core-1.2.1.jar;D:\Java\myeclipse\testSolrHbase\lib2\hamcrest-core-1.3.jar;D:\Java\myeclipse\testSolrHbase\lib2\hbase-annotations-0.98.21-hadoop1.jar;D:\Java\myeclipse\testSolrHbase\lib2\hbase-checkstyle-0.98.21-hadoop1.jar;D:\Java\myeclipse\testSolrHbase\lib2\hbase-client-0.98.21-hadoop1.jar;D:\Java\myeclipse\testSolrHbase\lib2\hbase-common-0.98.21-hadoop1-tests.jar;D:\Java\myeclipse\testSolrHbase\lib2\hbase-common-0.98.21-hadoop1.jar;D:\Java\myeclipse\testSolrHbase\lib2\hbase-examples-0.98.21-hadoop1.jar;D:\Java\myeclipse\testSolrHbase\lib2\hbase-hadoop-compat-0.98.21-hadoop1.jar;D:\Java\myeclipse\testSolrHbase\lib2\hbase-hadoop1-compat-0.98.21-hadoop1.jar;D:\Java\myeclipse\testSolrHbase\lib2\hbase-it-0.98.21-hadoop1-tests.jar;D:\Java\myeclipse\testSolrHbase\lib2\hbase-it-0.98.21-hadoop1.jar;D:\Java\myeclipse\testSolrHbase\lib2\hbase-prefix-tree-0.98.21-hadoop1.jar;D:\Java\myeclipse\testSolrHbase\lib2\hbase-protocol-0.98.21-hadoop1.jar;D:\Java\myeclipse\testSolrHbase\lib2\hbase-resource-bundle-0.98.21-hadoop1.jar;D:\Java\myeclipse\testSolrHbase\lib2\hbase-rest-0.98.21-hadoop1.jar;D:\Java\myeclipse\testSolrHbase\lib2\hbase-server-0.98.21-hadoop1-tests.jar;D:\Java\myeclipse\testSolrHbase\lib2\hbase-server-0.98.21-hadoop1.jar;D:\Java\myeclipse\testSolrHbase\lib2\hbase-shell-0.98.21-hadoop1.jar;D:\Java\myeclipse\testSolrHbase\lib2\hbase-testing-util-0.98.21-hadoop1.jar;D:\Java\myeclipse\testSolrHbase\lib2\hbase-thrift-0.98.21-hadoop1.jar;D:\Java\myeclipse\testSolrHbase\lib2\high-scale-lib-1.1.1.jar;D:\Java\myeclipse\testSolrHbase\lib2\htrace-core-2.04.jar;D:\Java\myeclipse\testSolrHbase\lib2\httpclient-4.1.3.jar;D:\Java\myeclipse\testSolrHbase\lib2\httpcore-4.1.3.jar;D:\Java\myeclipse\testSolrHbase\lib2\jackson-core-asl-1.8.8.jar;D:\Java\myeclipse\testSolrHbase\lib2\jackson-jaxrs-1.8.8.jar;D:\Java\myeclipse\testSolrHbase\lib2\jackson-mapper-asl-1.8.8.jar;D:\Java\myeclipse\testSolrHbase\lib2\jackson-xc-1.8.8.jar;D:\Java\myeclipse\testSolrHbase\lib2\jamon-runtime-2.4.1.jar;D:\Java\myeclipse\testSolrHbase\lib2\jasper-compiler-5.5.23.jar;D:\Java\myeclipse\testSolrHbase\lib2\jasper-runtime-5.5.23.jar;D:\Java\myeclipse\testSolrHbase\lib2\jaxb-api-2.2.2.jar;D:\Java\myeclipse\testSolrHbase\lib2\jaxb-impl-2.2.3-1.jar;D:\Java\myeclipse\testSolrHbase\lib2\jcodings-1.0.8.jar;D:\Java\myeclipse\testSolrHbase\lib2\jersey-client-1.8.jar;D:\Java\myeclipse\testSolrHbase\lib2\jersey-core-1.8.jar;D:\Java\myeclipse\testSolrHbase\lib2\jersey-json-1.8.jar;D:\Java\myeclipse\testSolrHbase\lib2\jersey-server-1.8.jar;D:\Java\myeclipse\testSolrHbase\lib2\jettison-1.3.1.jar;D:\Java\myeclipse\testSolrHbase\lib2\jetty-6.1.26.jar;D:\Java\myeclipse\testSolrHbase\lib2\jetty-sslengine-6.1.26.jar;D:\Java\myeclipse\testSolrHbase\lib2\jetty-util-6.1.26.jar;D:\Java\myeclipse\testSolrHbase\lib2\joni-2.1.2.jar;D:\Java\myeclipse\testSolrHbase\lib2\jruby-complete-1.6.8.jar;D:\Java\myeclipse\testSolrHbase\lib2\jsp-2.1-6.1.14.jar;D:\Java\myeclipse\testSolrHbase\lib2\jsp-api-2.1-6.1.14.jar;D:\Java\myeclipse\testSolrHbase\lib2\junit-4.11.jar;D:\Java\myeclipse\testSolrHbase\lib2\libthrift-0.9.0.jar;D:\Java\myeclipse\testSolrHbase\lib2\log4j-1.2.17.jar;D:\Java\myeclipse\testSolrHbase\lib2\metrics-core-2.2.0.jar;D:\Java\myeclipse\testSolrHbase\lib2\netty-3.6.6.Final.jar;D:\Java\myeclipse\testSolrHbase\lib2\protobuf-java-2.5.0.jar;D:\Java\myeclipse\testSolrHbase\lib2\servlet-api-2.5-6.1.14.jar;D:\Java\myeclipse\testSolrHbase\lib2\slf4j-api-1.6.4.jar;D:\Java\myeclipse\testSolrHbase\lib2\slf4j-log4j12-1.6.4.jar;D:\Java\myeclipse\testSolrHbase\lib2\xmlenc-0.52.jar;D:\Java\myeclipse\testSolrHbase\lib2\zookeeper-3.4.6.jar
16/09/01 08:43:52 INFO zookeeper.ZooKeeper: Client environment:java.library.path=C:\Program Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Common Files\lenovo\easyplussdk\bin;C:\Program Files\Java\jdk1.7.0_51\bin;D:\MySQL 5.5\bin;D:\MySQL Server 5.5\bin;D:\apache-maven-3.2.1\bin\;.
16/09/01 08:43:52 INFO zookeeper.ZooKeeper: Client environment:java.io.tmpdir=C:\Users\Yield\AppData\Local\Temp\
16/09/01 08:43:52 INFO zookeeper.ZooKeeper: Client environment:java.compiler=<NA>
16/09/01 08:43:52 INFO zookeeper.ZooKeeper: Client environment:os.name=Windows 7
16/09/01 08:43:52 INFO zookeeper.ZooKeeper: Client environment:os.arch=amd64
16/09/01 08:43:52 INFO zookeeper.ZooKeeper: Client environment:os.version=6.1
16/09/01 08:43:52 INFO zookeeper.ZooKeeper: Client environment:user.name=Yield
16/09/01 08:43:52 INFO zookeeper.ZooKeeper: Client environment:user.home=C:\Users\Yield
16/09/01 08:43:52 INFO zookeeper.ZooKeeper: Client environment:user.dir=D:\Java\myeclipse\testSolrHbase
16/09/01 08:43:52 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=server:2181 sessionTimeout=90000 watcher=org.apache.hadoop.hbase.zookeeper.PendingWatcher@25a97638
16/09/01 08:43:52 INFO zookeeper.ClientCnxn: Opening socket connection to server server/192.168.1.20:2181. Will not attempt to authenticate using SASL (unknown error)
16/09/01 08:43:52 INFO zookeeper.ClientCnxn: Socket connection established to server/192.168.1.20:2181, initiating session
16/09/01 08:43:52 INFO zookeeper.ClientCnxn: Session establishment complete on server server/192.168.1.20:2181, sessionid = 0x156d463d6b70da9, negotiated timeout = 60000
16/09/01 08:43:52 INFO zookeeper.RecoverableZooKeeper: Process identifier=catalogtracker-on-hconnection-0x42f73c55 connecting to ZooKeeper ensemble=server:2181
16/09/01 08:43:52 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=server:2181 sessionTimeout=90000 watcher=org.apache.hadoop.hbase.zookeeper.PendingWatcher@47eb5170
16/09/01 08:43:52 INFO zookeeper.ClientCnxn: Opening socket connection to server server/192.168.1.20:2181. Will not attempt to authenticate using SASL (unknown error)
16/09/01 08:43:52 INFO zookeeper.ClientCnxn: Socket connection established to server/192.168.1.20:2181, initiating session
16/09/01 08:43:52 INFO zookeeper.ClientCnxn: Session establishment complete on server server/192.168.1.20:2181, sessionid = 0x156d463d6b70daa, negotiated timeout = 60000
16/09/01 08:44:40 INFO client.RpcRetryingCaller: Call exception, tries=10, retries=35, retryTime=48552ms, msg=row 'Yield,,' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=datanode3,60020,1472442065747, seqNum=0
16/09/01 08:44:53 INFO client.RpcRetryingCaller: Call exception, tries=11, retries=35, retryTime=61179ms, msg=row 'Yield,,' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=datanode3,60020,1472442065747, seqNum=0
16/09/01 08:45:15 INFO client.RpcRetryingCaller: Call exception, tries=12, retries=35, retryTime=83738ms, msg=row 'Yield,,' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=datanode3,60020,1472442065747, seqNum=0
16/09/01 08:45:38 INFO client.RpcRetryingCaller: Call exception, tries=13, retries=35, retryTime=106475ms, msg=row 'Yield,,' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=datanode3,60020,1472442065747, seqNum=0
16/09/01 08:46:01 INFO client.RpcRetryingCaller: Call exception, tries=14, retries=35, retryTime=129038ms, msg=row 'Yield,,' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=datanode3,60020,1472442065747, seqNum=0
16/09/01 08:46:23 INFO client.RpcRetryingCaller: Call exception, tries=15, retries=35, retryTime=151629ms, msg=row 'Yield,,' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=datanode3,60020,1472442065747, seqNum=0
16/09/01 08:46:46 INFO client.RpcRetryingCaller: Call exception, tries=16, retries=35, retryTime=174379ms, msg=row 'Yield,,' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=datanode3,60020,1472442065747, seqNum=0
16/09/01 08:47:09 INFO client.RpcRetryingCaller: Call exception, tries=17, retries=35, retryTime=197034ms, msg=row 'Yield,,' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=datanode3,60020,1472442065747, seqNum=0
16/09/01 08:47:31 INFO client.RpcRetryingCaller: Call exception, tries=18, retries=35, retryTime=219691ms, msg=row 'Yield,,' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=datanode3,60020,1472442065747, seqNum=0
上面就是错误,一直尝试连接

下面是代码

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;  
import org.apache.hadoop.hbase.HTableDescriptor;  
import org.apache.hadoop.hbase.client.Get;  
import org.apache.hadoop.hbase.client.HBaseAdmin;  
import org.apache.hadoop.hbase.client.HTable;  
import org.apache.hadoop.hbase.client.Put;  
import org.apache.hadoop.hbase.client.Result;  
import org.apache.hadoop.hbase.client.ResultScanner;  
import org.apache.hadoop.hbase.client.Scan;  
import org.apache.hadoop.hbase.util.Bytes;
 
public class TestHbase {  
 
    /**
     * @param args
     */  
    static Configuration cfg=HBaseConfiguration.create();
    static {  
        cfg.set("hbase.zookeeper.quorum", "server");
//        cfg.set("hbase.zookeeper.property.clientPort", "9090");
        System.out.println("hbasemaster:"+cfg.get("hbase.master"));
        System.out.println("hbaserootdir:"+cfg.get("hbase.rootdir"));
    }  
    public static void main(String[] args) {  
        // TODO Auto-generated method stub  
        String tableName = "Yield";  
        String columnFamily = "cf";  
        try {  
 
            if (true == TestHbase.delete(tableName)) {  
                System.out.println("Delete Table " + tableName + " success!");  
 
            }  
 
            TestHbase.create(tableName, columnFamily);  
            TestHbase.put(tableName, "row1", columnFamily, "column1",  
                    "data1"); 

有一部分没有列出,因为就是一些简单的对表的crud,我觉得还是连接问题,是不是我没设置Zookeeper的端口啊?

益达口香糖的主页 益达口香糖 | 菜鸟二级 | 园豆:202
提问于:2016-09-01 08:59
< >
分享
所有回答(1)
0

你好,我也遇到这个问题了,请问楼主解决了没有啊

qck1126 | 园豆:202 (菜鸟二级) | 2017-03-03 15:54
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册