title: Hive Metatstore in mysql (over jdbc) failing - NoClassDefFoundError JdbcUriParseException
body: <p><strong>Problem Summary</strong>
  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.</p>
  <p><strong>Bash cli for hive interaction confirmed</strong></p>
  <pre><code>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&gt; _
  </code></pre>
  <p><em><strong>Mysql connecting successfully from planned user</strong></em></p>
  <pre><code>mysql -s -h 192.168.2.40 -u hiveuser -pNEVERYOUMIND
  mysql: [Warning] Using a password on the command line interface can be insecure.
  mysql&gt;
  </code></pre>
  <p><strong>Attempting to build the schema</strong></p>
  <pre><code>user@node:~ schematool -dbType mysql -initSchema -verbose
  Metastore connection URL:        jdbc:mysql://192.168.2.40:3306/metastore?createDatabaseIfNotExist=true&amp;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 &quot;main&quot; 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
  </code></pre>
  <p><strong>Effort to debug myself - searching for JdbcUriParseException</strong></p>
  <p>Traced all over google to ascertain where this occurs in the hive code - and only remotely close is this module -  <a href="https://github.com/apache/hive/blob/master/beeline/src/java/org/apache/hive/beeline/BeeLine.java" rel="nofollow noreferrer">https://github.com/apache/hive/blob/master/beeline/src/java/org/apache/hive/beeline/BeeLine.java</a> 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</p>
  <pre><code>          try {
              jdbcConnectionParams = Utils.extractURLComponents(jdbcURL, new Properties());
            } catch (JdbcUriParseException e) {
  </code></pre>
  <p><strong>here is the hive-site.xml</strong></p>
  <pre><code>&lt;configuration&gt;
          &lt;property&gt;
                  &lt;name&gt;javax.jdo.option.ConnectionURL&lt;/name&gt;
                  &lt;value&gt;jdbc:mysql://192.168.2.40:3306/metastore?createDatabaseIfNotExist=true&amp;amp;useSSL=false&lt;/value&gt;
                  &lt;description&gt;JDBC connect string for a JDBC metastore&lt;/description&gt;
          &lt;/property&gt;
          &lt;property&gt;
                  &lt;name&gt;javax.jdo.option.ConnectionDriverName&lt;/name&gt;
                  &lt;value&gt;com.mysql.jdbc.Driver&lt;/value&gt;
                  &lt;description&gt;Driver class name for a JDBC metastore&lt;/description&gt;
          &lt;/property&gt;
          &lt;property&gt;
                  &lt;name&gt;javax.jdo.option.ConnectionUserName&lt;/name&gt;
                  &lt;value&gt;hiveuser&lt;/value&gt;
                  &lt;description&gt;username to use against metastore database&lt;/description&gt;
          &lt;/property&gt;
          &lt;property&gt;
                  &lt;name&gt;javax.jdo.option.ConnectionPassword&lt;/name&gt;
                  &lt;value&gt;NEVERYOUMIND&lt;/value&gt;
                  &lt;description&gt;password to use against metastore database&lt;/description&gt;
          &lt;/property&gt;
          &lt;property&gt;
                  &lt;name&gt;hive.metastore.uris&lt;/name&gt;
                  &lt;value&gt;thrift://localhost:9083&lt;/value&gt;
          &lt;/property&gt;
  &lt;/configuration&gt;
  </code></pre>
  <p>The database user hiveuser connects and exists - and it can create tables when using mysql cli and workbench.</p>
  <p><strong>Java and Mysql Connector</strong>
  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.</p>