文章目录
1、Flink SQL Client 启动失败 Java版本问题
启动flink sql client
报错
[chb@test1 flink-1.12.1]$ ./bin/sql-client.sh embedded
2021-08-09 15:02:16,169 ERROR org.apache.hadoop.hive.metastore.utils.MetaStoreUtils [] - Got exception: java.lang.ClassCastException class [Ljava.lang.Object; cannot be cast to class [Ljava.net.URI; ([Ljava.lang.Object; and [Ljava.net.URI; are in module java.base of loader 'bootstrap')
java.lang.ClassCastException: class [Ljava.lang.Object; cannot be cast to class [Ljava.net.URI; ([Ljava.lang.Object; and [Ljava.net.URI; are in module java.base of loader 'bootstrap')
Exception in thread "main" org.apache.flink.table.client.SqlClientException: Unexpected exception. This is a bug. Please consider filing an issue.
at org.apache.flink.table.client.SqlClient.main(SqlClient.java:215)
Caused by: org.apache.flink.table.client.gateway.SqlExecutionException: Could not create execution context.
Caused by: org.apache.flink.table.catalog.exceptions.CatalogException: Failed to create Hive Metastore client
Caused by: MetaException(message:Got exception: java.lang.ClassCastException class [Ljava.lang.Object; cannot be cast to class [Ljava.net.URI; ([Ljava.lang.Object; and [Ljava.net.URI; are in module java.base of loader 'bootstrap'))
解决方法
在官网的教程上看到了如下信息:
关键就在"have a working Java8.x installation",这句话中并没有"or higher"之类的字眼,所以我推断当前版本的flink只能在Java8上工作,而我的JDK版本是Java11,抱着试一试的心态把JDK版本降为了Java8,再次启动flink,成功。所以遇到类似问题的朋友可以检查一下你们的JDK版本是否匹配。
2、sql client 启动报错ClassNotFoundException: org.apache.hadoop.conf.Configuration
参考:
https://stackoverflow.com/questions/60968006/classnotfoundexception-org-apache-hadoop-conf-configuration-starting-flink-sql
if you not add the HADOOP_HOME in you env, you can export the HADOOP_CLASSPATH, before run the ./bin/sql-client.sh embedded
export HADOOP_CLASSPATH=`hadoop classpath`
又报错Configured default database myhivedb doesn't exist in catalog myhive
default-database 需要在 hive 中创建。
3、Connection refused: localhost/127.0.0.1:8081
执行 Flink SQL 报错 [ERROR] Could not execute SQL statement. Reason: java.net.ConnectException: Connection refused
日志
上面无法看到正确错误,总是以为 是 Mysql 数据库连接错误, 最后日志flink-root-sql-client-chb1.log
Connection refused: localhost/127.0.0.1:8081
错误的原因:没有启动flink
启动 flink ./bin/start-cluster.sh