欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

windows+eclipse操作Hbase连接过程中debug记录(二)

程序员文章站 2022-05-30 15:06:51
...

windows+eclipse操作Hbase连接过程中debug记录(一)

4.java.lang.ClassNotFoundException:org.apache.hadoop.crypto. key.KeyProviderTokenIssuer

解决方式:pom.xml中少配置了公共jar包hadoop-commom,在其中增加如下依赖包:

        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-common</artifactId>
            <version>2.8.4</version>
    </dependency>

或者使用maven自动配置对应的包,我最终使用了maven,简洁的pom.xml配置如下

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.alex</groupId>
  <artifactId>hbasetest</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-complier-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <showWarnings>true</showWarnings>
                </configuration>
            </plugin>
        </plugins>
  </build>
  <dependencies>
    <dependency>
            <groupId>jdk.tools</groupId>
            <artifactId>jdk.tools</artifactId>
            <version>1.8</version>
            <scope>system</scope>
            <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>org.apache.hbase</groupId>
        <artifactId>hbase-client</artifactId>
        <version>1.4.9</version>
    </dependency>
  </dependencies>
</project>

5. Call to test01/47.106.221.38:34464 failed because org.apache.hadoop.net.ConnectTimeoutException

原因:网络错误,关闭linux防火墙,打开34464端口

6. Exception in thread "main" java.io.IOException: Failed to get result within timeout, timeout=60000ms

成功的创建了表,但是没有返回正确的结果到windows原因:

  1. host文件未配置(搜索到的最多答案,但我的确认配置无误)
  2. 时间阀值设置有误,我加入了一下设置后成功运行:
        conf.set("hbase.zookeeper.quorum","47.106.221.38");
        conf.set("zookeeper.znode.parent", "/hbase");
        conf.set("hbase.client.retries.number", "3");
        conf.set("hbase.rpc.timeout", "2000");
        conf.set("hbase.client.operation.timeout", "3000");
        conf.set("hbase.client.scanner.timeout.period", "10000");

提示绑定端口40892错误,打开阿里云服务器的这个端口,再次运行,成功。