mysql(超过 jdbc)中的 Hive Metatstore 失败 - NoClassDefFoundError JdbcUriParseException

Hive Metatstore in mysql (over jdbc) failing - NoClassDefFoundError JdbcUriParseException

问题总结 尝试将工作的 Hive 安装连接到功能正常的 mysql 数据库以创建 hcatalog(又名 Metastore) 已经按照规定配置了 hive-site.xml - 并且正在为每个不同的线程使用 Java 8 个。

Bash 配置单元交互的 cli 已确认

user@node:hive
Hive Session ID = 66da2903-6e11-43e6-95de-84bf41b1b977

Logging initialized using configuration in jar:file:/home/hadoop/apache-hive-3.1.2-bin/lib/hive-common-3.1.2.jar!/hive-log4j2.properties Async: true
Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.
hive> _

Mysql 从计划用户连接成功

mysql -s -h 192.168.2.40 -u hiveuser -pNEVERYOUMIND
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql>

正在尝试构建架构

user@node:~ schematool -dbType mysql -initSchema -verbose
Metastore connection URL:        jdbc:mysql://192.168.2.40:3306/metastore?createDatabaseIfNotExist=true&useSSL=false
Metastore Connection Driver :    com.mysql.jdbc.Driver
Metastore connection User:       hiveuser
Starting metastore schema initialization to 3.1.0
Initialization script hive-schema-3.1.0.mysql.sql
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hive/jdbc/JdbcUriParseException ...
        at org.apache.hive.beeline.HiveSchemaTool.runBeeLine(HiveSchemaTool.java:1213)
        at org.apache.hive.beeline.HiveSchemaTool.runBeeLine(HiveSchemaTool.java:1204)
        at org.apache.hive.beeline.HiveSchemaTool.doInit(HiveSchemaTool.java:590)
        at org.apache.hive.beeline.HiveSchemaTool.doInit(HiveSchemaTool.java:567)
        at org.apache.hive.beeline.HiveSchemaTool.main(HiveSchemaTool.java:1517)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:323)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:236)
Caused by: java.lang.ClassNotFoundException: org.apache.hive.jdbc.JdbcUriParseException
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        ... 11 more

努力调试自己——搜索JdbcUriParseException

遍历 google 以确定这在配置单元代码中发生的位置 - 并且此模块仅远程关闭 - https://github.com/apache/hive/blob/master/beeline/src/java/org/apache/hive/beeline/BeeLine.java 提交 91ab242,第 1190 行 但是由于在我的输出中没有 Beeline 调用(也许在 ...11 更多?)我无法确定参数(下面)在哪里导致问题

          try {
            jdbcConnectionParams = Utils.extractURLComponents(jdbcURL, new Properties());
          } catch (JdbcUriParseException e) {

这里是蜂巢-site.xml

<configuration>
        <property>
                <name>javax.jdo.option.ConnectionURL</name>
                <value>jdbc:mysql://192.168.2.40:3306/metastore?createDatabaseIfNotExist=true&amp;useSSL=false</value>
                <description>JDBC connect string for a JDBC metastore</description>
        </property>
        <property>
                <name>javax.jdo.option.ConnectionDriverName</name>
                <value>com.mysql.jdbc.Driver</value>
                <description>Driver class name for a JDBC metastore</description>
        </property>
        <property>
                <name>javax.jdo.option.ConnectionUserName</name>
                <value>hiveuser</value>
                <description>username to use against metastore database</description>
        </property>
        <property>
                <name>javax.jdo.option.ConnectionPassword</name>
                <value>NEVERYOUMIND</value>
                <description>password to use against metastore database</description>
        </property>
        <property>
                <name>hive.metastore.uris</name>
                <value>thrift://localhost:9083</value>
        </property>
</configuration>

数据库用户 hiveuser 连接并存在 - 使用 mysql cli 和 workbench.

时可以创建表

Java 和 Mysql 连接器 尝试了各种方法,包括 Java 11 和 Java 8 - mysql 版本 5 连接器和 8 连接器 - 都呈现相同的结果 - 所以我不确定这是否与 JDBC 相关 - -不胜感激。

您的 class 路径中缺少 hive-jdbc 个 jar。

https://findjar.com/ 上寻找 class org.apache.hive.jdbc.JdbcUriParseException *
此引擎能够找到包含 class.

的 jar

以下是 class 未找到异常的结果:https://findjar.com/class/org/apache/hive/jdbc/JdbcUriParseException.html

*我认为此资源对解决此类问题很有用,我不隶属于该网站,也不以任何方式推广它