IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 大数据 -> 【所有错误已解决】client JDBC连接hbase、phoenix失败的所有错误都在这里! -> 正文阅读

[大数据]【所有错误已解决】client JDBC连接hbase、phoenix失败的所有错误都在这里!

这里是我遇到的hbase、phoenix的所有错误,均已找到解决方法

错误一:java.lang.NoSuchMethodError

报错信息如下

(1)第一种错误

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.hadoop.security.authentication.util.KerberosUtil.hasKerberosKeyTab(Ljavax/security/auth/Subject;)Z
	at org.apache.hadoop.security.UserGroupInformation.<init>(UserGroupInformation.java:715)
	at org.apache.hadoop.security.UserGroupInformation.loginUserFromSubject(UserGroupInformation.java:925)
	at org.apache.hadoop.security.UserGroupInformation.getLoginUser(UserGroupInformation.java:873)
	at org.apache.hadoop.security.UserGroupInformation.getCurrentUser(UserGroupInformation.java:740)
	at org.apache.hadoop.hbase.security.User$SecureHadoopUser.<init>(User.java:266)
	at org.apache.hadoop.hbase.security.User.getCurrent(User.java:164)
	at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver$ConnectionInfo.<init>(PhoenixEmbeddedDriver.java:504)
	at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver$ConnectionInfo.create(PhoenixEmbeddedDriver.java:312)
	at org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:232)
	at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.createConnection(PhoenixEmbeddedDriver.java:150)
	at org.apache.phoenix.jdbc.PhoenixDriver.connect(PhoenixDriver.java:221)
	at java.sql.DriverManager.getConnection(DriverManager.java:664)
	at java.sql.DriverManager.getConnection(DriverManager.java:270)
	at com.layne.phoenix.PhoenixTest.main(PhoenixTest.java:19)

Process finished with exit code 1

(2)第二种错误

Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V
	at org.apache.hadoop.conf.Configuration.set(Configuration.java:1357)
	at org.apache.hadoop.conf.Configuration.set(Configuration.java:1338)
	at org.apache.hadoop.conf.Configuration.setIfUnset(Configuration.java:1433)
	at org.apache.phoenix.query.QueryServicesOptions.setIfUnset(QueryServicesOptions.java:467)
	at org.apache.phoenix.query.QueryServicesOptions.withDefaults(QueryServicesOptions.java:381)
	at org.apache.phoenix.query.QueryServicesImpl.<init>(QueryServicesImpl.java:36)
	at org.apache.phoenix.jdbc.PhoenixDriver.getQueryServices(PhoenixDriver.java:197)
	at org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:235)
	at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.createConnection(PhoenixEmbeddedDriver.java:150)
	at org.apache.phoenix.jdbc.PhoenixDriver.connect(PhoenixDriver.java:221)
	at java.sql.DriverManager.getConnection(DriverManager.java:664)
	at java.sql.DriverManager.getConnection(DriverManager.java:270)
	at com.layne.phoenix.PhoenixTest.main(PhoenixTest.java:19)

解决方法

使用如下maven依赖,缺一不可,注意jar包版本要和集群中使用的一致

    <dependencies>
        <dependency>
            <groupId>org.apache.phoenix</groupId>
            <artifactId>phoenix-core</artifactId>
            <version>5.0.0-HBase-2.0</version>
        </dependency>

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

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>27.0-jre</version>
        </dependency>
    </dependencies>

错误二:org.apache.hbase.thirdparty.io.netty.channel.ConnectTimeoutException

报错信息如下

(1)第一个错误

Thu Oct 07 19:55:03 CST 2021, RpcRetryingCaller{globalStartTime=1633607574392, pause=100, maxAttempts=16}, org.apache.hadoop.hbase.MasterNotRunningException: java.net.ConnectException: Call to hadoop102/xx.xx.xx.xxx:16000 failed on connection exception: org.apache.hbase.thirdparty.io.netty.channel.ConnectTimeoutException: connection timed out: hadoop102/xx.xx.xx.xxx:16000
Thu Oct 07 19:55:33 CST 2021, RpcRetryingCaller{globalStartTime=1633607574392, pause=100, maxAttempts=16}, org.apache.hadoop.hbase.MasterNotRunningException: java.net.ConnectException: Call to hadoop102/xx.xx.xx.xxx:16000 failed on connection exception: org.apache.hbase.thirdparty.io.netty.channel.ConnectTimeoutException: connection timed out: hadoop102/xx.xx.xx.xxx:16000
Thu Oct 07 19:56:03 CST 2021, RpcRetryingCaller{globalStartTime=1633607574392, pause=100, maxAttempts=16}, org.apache.hadoop.hbase.MasterNotRunningException: java.net.ConnectException: Call to hadoop102/xx.xx.xx.xxx:16000 failed on connection exception: org.apache.hbase.thirdparty.io.netty.channel.ConnectTimeoutException: connection timed out: hadoop102/xx.xx.xx.xxx:16000
Thu Oct 07 19:56:33 CST 2021, RpcRetryingCaller{globalStartTime=1633607574392, pause=100, maxAttempts=16}, org.apache.hadoop.hbase.MasterNotRunningException: java.net.ConnectException: Call to hadoop102/xx.xx.xx.xxx:16000 failed on connection exception: org.apache.hbase.thirdparty.io.netty.channel.ConnectTimeoutException: connection timed out: hadoop102/xx.xx.xx.xxx:16000
Thu Oct 07 19:57:03 CST 2021, RpcRetryingCaller{globalStartTime=1633607574392, pause=100, maxAttempts=16}, org.apache.hadoop.hbase.MasterNotRunningException: java.net.ConnectException: Call to hadoop102/xx.xx.xx.xxx:16000 failed on connection exception: org.apache.hbase.thirdparty.io.netty.channel.ConnectTimeoutException: connection timed out: hadoop102/xx.xx.xx.xxx:16000

	at org.apache.hadoop.hbase.client.RpcRetryingCallerImpl.callWithRetries(RpcRetryingCallerImpl.java:145)
	at org.apache.hadoop.hbase.client.HBaseAdmin.executeCallable(HBaseAdmin.java:3055)
	at org.apache.hadoop.hbase.client.HBaseAdmin.getTableDescriptor(HBaseAdmin.java:525)
	at org.apache.hadoop.hbase.client.HBaseAdmin.getDescriptor(HBaseAdmin.java:332)
	at org.apache.phoenix.query.ConnectionQueryServicesImpl.ensureTableCreated(ConnectionQueryServicesImpl.java:1118)
	... 20 more
Caused by: org.apache.hadoop.hbase.MasterNotRunningException: java.net.ConnectException: Call to hadoop102/xx.xx.xx.xxx:16000 failed on connection exception: org.apache.hbase.thirdparty.io.netty.channel.ConnectTimeoutException: connection timed out: hadoop102/xx.xx.xx.xxx:16000
	at org.apache.hadoop.hbase.client.ConnectionImplementation$MasterServiceStubMaker.makeStub(ConnectionImplementation.java:1154)
	at org.apache.hadoop.hbase.client.ConnectionImplementation.getKeepAliveMasterService(ConnectionImplementation.java:1213)
	at org.apache.hadoop.hbase.client.ConnectionImplementation.getMaster(ConnectionImplementation.java:1202)
	at org.apache.hadoop.hbase.client.MasterCallable.prepare(MasterCallable.java:57)
	at org.apache.hadoop.hbase.client.RpcRetryingCallerImpl.callWithRetries(RpcRetryingCallerImpl.java:105)
	... 24 more
Caused by: java.net.ConnectException: Call to hadoop102/xx.xx.xx.xxx:16000 failed on connection exception: org.apache.hbase.thirdparty.io.netty.channel.ConnectTimeoutException: connection timed out: hadoop102/xx.xx.xx.xxx:16000
	at org.apache.hadoop.hbase.ipc.IPCUtil.wrapException(IPCUtil.java:165)
	at org.apache.hadoop.hbase.ipc.AbstractRpcClient.onCallFinished(AbstractRpcClient.java:390)
	at org.apache.hadoop.hbase.ipc.AbstractRpcClient.access$100(AbstractRpcClient.java:95)
	at org.apache.hadoop.hbase.ipc.AbstractRpcClient$3.run(AbstractRpcClient.java:410)
	at org.apache.hadoop.hbase.ipc.AbstractRpcClient$3.run(AbstractRpcClient.java:406)
	at org.apache.hadoop.hbase.ipc.Call.callComplete(Call.java:103)
	at org.apache.hadoop.hbase.ipc.Call.setException(Call.java:118)
	at org.apache.hadoop.hbase.ipc.BufferCallBeforeInitHandler.userEventTriggered(BufferCallBeforeInitHandler.java:92)
	at org.apache.hbase.thirdparty.io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:329)
	at org.apache.hbase.thirdparty.io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:315)
	at org.apache.hbase.thirdparty.io.netty.channel.AbstractChannelHandlerContext.fireUserEventTriggered(AbstractChannelHandlerContext.java:307)
	at org.apache.hbase.thirdparty.io.netty.channel.DefaultChannelPipeline$HeadContext.userEventTriggered(DefaultChannelPipeline.java:1377)
	at org.apache.hbase.thirdparty.io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:329)
	at org.apache.hbase.thirdparty.io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:315)
	at org.apache.hbase.thirdparty.io.netty.channel.DefaultChannelPipeline.fireUserEventTriggered(DefaultChannelPipeline.java:929)
	at org.apache.hadoop.hbase.ipc.NettyRpcConnection.failInit(NettyRpcConnection.java:179)
	at org.apache.hadoop.hbase.ipc.NettyRpcConnection.access$500(NettyRpcConnection.java:71)
	at org.apache.hadoop.hbase.ipc.NettyRpcConnection$3.operationComplete(NettyRpcConnection.java:267)
	at org.apache.hadoop.hbase.ipc.NettyRpcConnection$3.operationComplete(NettyRpcConnection.java:261)
	at org.apache.hbase.thirdparty.io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:507)
	at org.apache.hbase.thirdparty.io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:500)
	at org.apache.hbase.thirdparty.io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:479)
	at org.apache.hbase.thirdparty.io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:420)
	at org.apache.hbase.thirdparty.io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:122)
	at org.apache.hbase.thirdparty.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe$1.run(AbstractNioChannel.java:269)
	at org.apache.hbase.thirdparty.io.netty.util.concurrent.PromiseTask$RunnableAdapter.call(PromiseTask.java:38)
	at org.apache.hbase.thirdparty.io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:120)
	at org.apache.hbase.thirdparty.io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
	at org.apache.hbase.thirdparty.io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403)
	at org.apache.hbase.thirdparty.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463)
	at org.apache.hbase.thirdparty.io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
	at org.apache.hbase.thirdparty.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.hbase.thirdparty.io.netty.channel.ConnectTimeoutException: connection timed out: hadoop102/xx.xx.xx.xxx:16000
	at org.apache.hbase.thirdparty.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe$1.run(AbstractNioChannel.java:267)
	... 8 more
2021-10-07 19:57:03,827 INFO [org.apache.zookeeper.ZooKeeper] - Session: 0x300000194820023 closed
2021-10-07 19:57:03,834 INFO [org.apache.zookeeper.ClientCnxn] - EventThread shut down for session: 0x300000194820023

(2)第二个错误

2021-10-07 20:02:06,444 INFO [org.apache.hadoop.hbase.client.RpcRetryingCallerImpl] - Call exception, tries=6, retries=6, started=35839 ms ago, cancelled=false, msg=Call to hadoop104/xx.xx.xx.xxx:16020 failed on connection exception: org.apache.hbase.thirdparty.io.netty.channel.ConnectTimeoutException: connection timed out: hadoop104/xx.xx.xx.xxx:16020, details=row 'SYSTEM:CATALOG' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=hadoop104,16020,1633605395295, seqNum=-1
2021-10-07 20:02:20,509 INFO [org.apache.hadoop.hbase.client.RpcRetryingCallerImpl] - Call exception, tries=7, retries=7, started=49904 ms ago, cancelled=false, msg=Call to hadoop104/xx.xx.xx.xxx:16020 failed on connection exception: org.apache.hbase.thirdparty.io.netty.channel.ConnectTimeoutException: connection timed out: hadoop104/xx.xx.xx.xxx:16020, details=row 'SYSTEM:CATALOG' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=hadoop104,16020,1633605395295, seqNum=-1
2021-10-07 20:02:40,614 INFO [org.apache.hadoop.hbase.client.RpcRetryingCallerImpl] - Call exception, tries=8, retries=8, started=70009 ms ago, cancelled=false, msg=Call to hadoop104/xx.xx.xx.xxx:16020 failed on connection exception: org.apache.hbase.thirdparty.io.netty.channel.ConnectTimeoutException: connection timed out: hadoop104/xx.xx.xx.xxx:16020, details=row 'SYSTEM:CATALOG' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=hadoop104,16020,1633605395295, seqNum=-1
2021-10-07 20:03:00,695 INFO [org.apache.hadoop.hbase.client.RpcRetryingCallerImpl] - Call exception, tries=9, retries=9, started=90090 ms ago, cancelled=false, msg=Call to hadoop104/xx.xx.xx.xxx:16020 failed on connection exception: org.apache.hbase.thirdparty.io.netty.channel.ConnectTimeoutException: connection timed out: hadoop104/xx.xx.xx.xxx:16020, details=row 'SYSTEM:CATALOG' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=hadoop104,16020,1633605395295, seqNum=-1
2021-10-07 20:03:20,757 INFO [org.apache.hadoop.hbase.client.RpcRetryingCallerImpl] - Call exception, tries=10, retries=10, started=110152 ms ago, cancelled=false, msg=Call to hadoop104/xx.xx.xx.xxx:16020 failed on connection exception: org.apache.hbase.thirdparty.io.netty.channel.ConnectTimeoutException: connection timed out: hadoop104/xx.xx.xx.xxx:16020, details=row 'SYSTEM:CATALOG' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=hadoop104,16020,1633605395295, seqNum=-1
2021-10-07 20:03:40,865 INFO [org.apache.hadoop.hbase.client.RpcRetryingCallerImpl] - Call exception, tries=11, retries=11, started=130260 ms ago, cancelled=false, msg=Call to hadoop104/xx.xx.xx.xxx:16020 failed on connection exception: org.apache.hbase.thirdparty.io.netty.channel.ConnectTimeoutException: connection timed out: hadoop104/xx.xx.xx.xxx:16020, details=row 'SYSTEM:CATALOG' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=hadoop104,16020,1633605395295, seqNum=-1

解决方法,远程服务器开启三个端口:

16000
16020
16010

错误三:org.apache.phoenix.util.LogUtil.getCallerStackTrace

错误信息如下

2021-10-07 19:52:51,418 INFO [org.apache.phoenix.query.ConnectionQueryServicesImpl] - HConnection established. Stacktrace for informational purposes: hconnection-0x451001e5 java.lang.Thread.getStackTrace(Thread.java:1552)
org.apache.phoenix.util.LogUtil.getCallerStackTrace(LogUtil.java:55)
org.apache.phoenix.query.ConnectionQueryServicesImpl.openConnection(ConnectionQueryServicesImpl.java:432)
org.apache.phoenix.query.ConnectionQueryServicesImpl.access$400(ConnectionQueryServicesImpl.java:272)
org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:2556)
org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:2532)
org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:76)
org.apache.phoenix.query.ConnectionQueryServicesImpl.init(ConnectionQueryServicesImpl.java:2532)
org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:255)
org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.createConnection(PhoenixEmbeddedDriver.java:150)
org.apache.phoenix.jdbc.PhoenixDriver.connect(PhoenixDriver.java:221)
java.sql.DriverManager.getConnection(DriverManager.java:664)
java.sql.DriverManager.getConnection(DriverManager.java:270)
com.layne.phoenix.PhoenixTest.main(PhoenixTest.java:19)

这个只是log4j打印大的info信息,不算错误,可以忽略它,如果真的不想看见它,可以设置log4j.properties

附:JDBC连接phoenix代码

import java.sql.*;
public class PhoenixTest {

    public static void main(String[] args) throws ClassNotFoundException, SQLException {

        //1.定义参数
        String driver = "org.apache.phoenix.jdbc.PhoenixDriver";
        String url = "jdbc:phoenix:hadoop102,hadoop103,hadoop104:2181";

        //2.加载驱动
        Class.forName(driver);

        //3.创建连接
        Connection connection = DriverManager.getConnection(url);

        //4.预编译SQL
        PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM STUDENT");

        //5.查询获取返回值
        ResultSet resultSet = preparedStatement.executeQuery();

        //6.打印结果
        while (resultSet.next()) {
            System.out.println(resultSet.getString(1) + resultSet.getString(2));
        }

        //7.关闭资源
        resultSet.close();
        preparedStatement.close();
        connection.close();
    }
}
  大数据 最新文章
实现Kafka至少消费一次
亚马逊云科技:还在苦于ETL?Zero ETL的时代
初探MapReduce
【SpringBoot框架篇】32.基于注解+redis实现
Elasticsearch:如何减少 Elasticsearch 集
Go redis操作
Redis面试题
专题五 Redis高并发场景
基于GBase8s和Calcite的多数据源查询
Redis——底层数据结构原理
上一篇文章      下一篇文章      查看所有文章
加:2021-10-08 11:51:37  更:2021-10-08 11:54:15 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/24 0:48:49-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码