代码就不贴了,直接上打印出来的log情况。以下是log,然后一直等待,没有结果。
16/07/21 09:22:36 INFO zookeeper.ZooKeeperWrapper: Reconnecting to zookeeper
16/07/21 09:22:36 INFO zookeeper.ZooKeeper: Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT
16/07/21 09:22:36 INFO zookeeper.ZooKeeper: Client environment:host.name=master
16/07/21 09:22:36 INFO zookeeper.ZooKeeper: Client environment:java.version=1.8.0_91
16/07/21 09:22:36 INFO zookeeper.ZooKeeper: Client environment:java.vendor=Oracle Corporation
16/07/21 09:22:36 INFO zookeeper.ZooKeeper: Client environment:java.home=/usr/lib/jvm/java-8-openjdk-amd64/jre
16/07/21 09:22:36 INFO zookeeper.ZooKeeper: Client environment:java.class.path=/home/yang/workspace3/EducationCloud/build/classes:/usr/soft/apache-tomcat-8.0.36/lib/jsp-api.jar:/usr/soft/apache-tomcat-8.0.36/lib/catalina-ant.jar:/usr/soft/apache-tomcat-8.0.36/lib/jasper.jar:/usr/soft/apache-tomcat-8.0.36/lib/catalina-storeconfig.jar:/usr/soft/apache-tomcat-8.0.36/lib/catalina-tribes.jar:/usr/soft/apache-tomcat-8.0.36/lib/tomcat-util.jar:/usr/soft/apache-tomcat-8.0.36/lib/tomcat-i18n-fr.jar:/usr/soft/apache-tomcat-8.0.36/lib/websocket-api.jar:/usr/soft/apache-tomcat-8.0.36/lib/catalina-ha.jar:/usr/soft/apache-tomcat-8.0.36/lib/el-api.jar:/usr/soft/apache-tomcat-8.0.36/lib/tomcat-i18n-es.jar:/usr/soft/apache-tomcat-8.0.36/lib/catalina.jar:/usr/soft/apache-tomcat-8.0.36/lib/tomcat-websocket.jar:/usr/soft/apache-tomcat-8.0.36/lib/tomcat-util-scan.jar:/usr/soft/apache-tomcat-8.0.36/lib/jasper-el.jar:/usr/soft/apache-tomcat-8.0.36/lib/tomcat-jdbc.jar:/usr/soft/apache-tomcat-8.0.36/lib/tomcat-i18n-ja.jar:/usr/soft/apache-tomcat-8.0.36/lib/ecj-4.5.jar:/usr/soft/apache-tomcat-8.0.36/lib/annotations-api.jar:/usr/soft/apache-tomcat-8.0.36/lib/servlet-api.jar:/usr/soft/apache-tomcat-8.0.36/lib/tomcat-api.jar:/usr/soft/apache-tomcat-8.0.36/lib/tomcat-coyote.jar:/usr/soft/apache-tomcat-8.0.36/lib/tomcat-dbcp.jar:/usr/soft/apache-tomcat-8.0.36/lib/tomcat-jni.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/aopalliance-repackaged-2.4.0-b34.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/apache-commons-lang.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/asm-debug-all-5.0.4.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/commons-beanutils-1.9.2.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/commons-logging-1.2.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/commons-pool-1.5.6.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/hadoop-0.20.2-core.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/hbase-0.21.0-20100622.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/hbase-0.94.9.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/hbase-client-0.95.2-hadoop2.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/hbase-client-1.2.2.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/hbase-hadoop2-compat-1.2.2.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/hbase-jdo-0.1-20100121.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/hbase-trx-0.90.0RC3.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/hk2-api-2.4.0-b34.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/hk2-locator-2.4.0-b34.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/hk2-utils-2.4.0-b34.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/javassist-3.18.1-GA.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/javax.annotation-api-1.2.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/javax.inject-2.4.0-b34.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/javax.servlet-api-3.0.1.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/javax.ws.rs-api-2.0.1.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/jaxb-api-2.2.7.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/jersey-client.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/jersey-common.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/jersey-container-servlet-core.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/jersey-container-servlet.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/jersey-guava-2.23.1.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/jersey-media-jaxb.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/jersey-server.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/log4j-1.2.17.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/logback-core-0.9.6.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/org.osgi.core-4.2.0.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/osgi-resource-locator-1.0.1.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/persistence-api-1.0.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/slf4j-api-1.7.7.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/slf4j-log4j12-1.7.5.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/validation-api-1.1.0.Final.jar:/home/yang/workspace3/EducationCloud/WebContent/WEB-INF/lib/zookeeper-3.4.6.jar
16/07/21 09:22:36 INFO zookeeper.ZooKeeper: Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
16/07/21 09:22:36 INFO zookeeper.ZooKeeper: Client environment:java.io.tmpdir=/tmp
16/07/21 09:22:36 INFO zookeeper.ZooKeeper: Client environment:java.compiler=<NA>
16/07/21 09:22:36 INFO zookeeper.ZooKeeper: Client environment:os.name=Linux
16/07/21 09:22:36 INFO zookeeper.ZooKeeper: Client environment:os.arch=amd64
16/07/21 09:22:36 INFO zookeeper.ZooKeeper: Client environment:os.version=4.4.0-31-generic
16/07/21 09:22:36 INFO zookeeper.ZooKeeper: Client environment:user.name=yang
16/07/21 09:22:36 INFO zookeeper.ZooKeeper: Client environment:user.home=/home/yang
16/07/21 09:22:36 INFO zookeeper.ZooKeeper: Client environment:user.dir=/home/yang/workspace3/EducationCloud
16/07/21 09:22:36 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=secondMaster:2181 sessionTimeout=60000 watcher=org.apache.hadoop.hbase.zookeeper.ZooKeeperWrapper@768debd
16/07/21 09:22:36 INFO zookeeper.ClientCnxn: Opening socket connection to server secondMaster/172.16.41.54:2181. Will not attempt to authenticate using SASL (unknown error)
16/07/21 09:22:36 INFO zookeeper.ClientCnxn: Socket connection established to secondMaster/172.16.41.54:2181, initiating session
16/07/21 09:22:36 INFO zookeeper.ClientCnxn: Session establishment complete on server secondMaster/172.16.41.54:2181, sessionid = 0x1560adb38350015, negotiated timeout = 60000
导致问题的原因是jar包问题,刚开始我是一个一个JAR包手动添加,报什么错就加什么JAR包,加了很多JAR包,直接没有报错,然后就是上面的log显示的情况,没有查询结果,也没有报错,相当难过。
最后的解决办法是:直接找到Hbase的lib目录,然后把此目录下的JAR包全部添加到项目,问题解决。