hive metatstore in mysql (over jdbc) failing:noclassdeffounderror jdbcuriparseexception

w6lpcovy  于 2021-04-02  发布在  Hive
关注(0)|答案(1)|浏览(816)

问题摘要 试图将一个工作中的hive安装连接到一个正常运行的mysql数据库来创建hcatalog (也就是metastore),已经按照规定配置了hive-site.xml--并且正在使用java 8来解决各种线程。
确认了hive交互的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上查遍了所有的地方,以确定在hive的代码中出现了这种情况--只有这个模块与之接近--https://github.com/apache/hive/blob/master/beeline/src/java/org/apache/hive/beeline/beeline.java commit 91ab242 ,第1190行,但由于在我的输出中没有beeline调用(也许是在...11更多的?

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

这里是hive-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>

当使用mysql cli和workbench时,数据库用户hiveuser连接并存在--并且它可以创建表。
java和mysql连接器已经尝试了各种包括java 11和java 8 - mysql版本5连接器和8连接器 - 所有呈现相同的结果 - 所以我不确定这是jdbc相关的 - - 另一种观点将是感激地收到。

tcomlyy6

tcomlyy61#

你的classpath中缺少hive-jdbcjar。
在https://findjar.com/ 上查找org.apache.hive.jdbc.JdbcUriParseException类 *。
这个引擎能够找到包含一个类的jar。
以下是找不到类的异常结果:https://findjar.com/class/org/apache/hive/jdbc/jdbcuriparseexception.html。

  • 我认为这个资源对解决这样的问题是有用的,我不附属于该网站,也不以任何方式推广它。

相关问题