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

Viewed 505

Problem Summary Attempting to connect a working Hive installation to a functioning mysql database to create the hcatalog (aka metastore) Have configured the hive-site.xml as prescribed - and am using Java 8 per various threads out there.

Bash cli for hive interaction confirmed

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 connecting successfully from planned user

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

Attempting to build the schema

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

Effort to debug myself - searching for JdbcUriParseException

Traced all over google to ascertain where this occurs in the hive code - and only remotely close is this module - https://github.com/apache/hive/blob/master/beeline/src/java/org/apache/hive/beeline/BeeLine.java commit 91ab242 , Line 1190 But as there is no Beeline calls in my output (perhaps in the ...11 more?) I am unable to ascertain where the parameters (below) are causing issue

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

here is the 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>

The database user hiveuser connects and exists - and it can create tables when using mysql cli and workbench.

Java and Mysql Connector Have tried various including Java 11 and Java 8 - mysql version 5 connector and 8 connector - all render the same results - so am not sure this is JDBC related - - another perspective would be gratefully received.

1 Answers
Related