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

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

问题摘要 试图将一个工作中的hive安装连接到一个正常运行的mysql数据库来创建hcatalog (也就是metastore),已经按照规定配置了hive-site.xml--并且正在使用java 8来解决各种线程。
确认了hive交互的bash cli。

  1. user@node:hive
  2. Hive Session ID = 66da2903-6e11-43e6-95de-84bf41b1b977
  3. 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
  4. 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.
  5. hive> _

mysql从计划中的用户成功连接。

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

试图建立模式

  1. user@node:~ schematool -dbType mysql -initSchema -verbose
  2. Metastore connection URL: jdbc:mysql://192.168.2.40:3306/metastore?createDatabaseIfNotExist=true&useSSL=false
  3. Metastore Connection Driver : com.mysql.jdbc.Driver
  4. Metastore connection User: hiveuser
  5. Starting metastore schema initialization to 3.1.0
  6. Initialization script hive-schema-3.1.0.mysql.sql
  7. Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hive/jdbc/JdbcUriParseException ...
  8. at org.apache.hive.beeline.HiveSchemaTool.runBeeLine(HiveSchemaTool.java:1213)
  9. at org.apache.hive.beeline.HiveSchemaTool.runBeeLine(HiveSchemaTool.java:1204)
  10. at org.apache.hive.beeline.HiveSchemaTool.doInit(HiveSchemaTool.java:590)
  11. at org.apache.hive.beeline.HiveSchemaTool.doInit(HiveSchemaTool.java:567)
  12. at org.apache.hive.beeline.HiveSchemaTool.main(HiveSchemaTool.java:1517)
  13. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  14. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  15. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  16. at java.lang.reflect.Method.invoke(Method.java:498)
  17. at org.apache.hadoop.util.RunJar.run(RunJar.java:323)
  18. at org.apache.hadoop.util.RunJar.main(RunJar.java:236)
  19. Caused by: java.lang.ClassNotFoundException: org.apache.hive.jdbc.JdbcUriParseException
  20. at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
  21. at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
  22. at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
  23. at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
  24. ... 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更多的?

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

这里是hive-site.xml。

  1. <configuration>
  2. <property>
  3. <name>javax.jdo.option.ConnectionURL</name>
  4. <value>jdbc:mysql://192.168.2.40:3306/metastore?createDatabaseIfNotExist=true&amp;useSSL=false</value>
  5. <description>JDBC connect string for a JDBC metastore</description>
  6. </property>
  7. <property>
  8. <name>javax.jdo.option.ConnectionDriverName</name>
  9. <value>com.mysql.jdbc.Driver</value>
  10. <description>Driver class name for a JDBC metastore</description>
  11. </property>
  12. <property>
  13. <name>javax.jdo.option.ConnectionUserName</name>
  14. <value>hiveuser</value>
  15. <description>username to use against metastore database</description>
  16. </property>
  17. <property>
  18. <name>javax.jdo.option.ConnectionPassword</name>
  19. <value>NEVERYOUMIND</value>
  20. <description>password to use against metastore database</description>
  21. </property>
  22. <property>
  23. <name>hive.metastore.uris</name>
  24. <value>thrift://localhost:9083</value>
  25. </property>
  26. </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。

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

相关问题