Error while initializing Metabase as a Service in Windows Services

Hi I´m having trouble while initializing Metabase, I have Java 8 set as my enviroment variable, but with a script I explicitly tell Windows to run Metabase using Java 11 OpenJDK. Somehow I get it working after running metabase with Java 8 and then again with Java 11, but I would like to know what makes it fail, in that initial set up. Thank you, for your help

Warning: environ value C:\Program Files\Java\jre1.8.0_301 for key :java-home has been overwritten with C:\Program Files\Eclipse Foundation\jdk-11.0.12.7-hotspot
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
2021-11-29 10:24:45,857 INFO metabase.util :: Maximum memory available to JVM: 6.3 GB
2021-11-29 10:25:00,169 INFO util.encryption :: Saved credentials encryption is DISABLED for this Metabase instance.
For more information, see https://metabase.com/docs/latest/operations-guide/encrypting-database-details-at-rest.html
2021-11-29 10:25:03,028 INFO driver.impl :: Registered abstract driver :sql
? Load driver :sql took 633.8 ms
2021-11-29 10:25:03,044 INFO driver.impl :: Registered abstract driver :sql-jdbc (parents: [:sql])
Load driver :sql-jdbc took 647.5 ms
2021-11-29 10:25:03,044 INFO driver.impl :: Registered driver :h2 (parents: [:sql-jdbc])
2021-11-29 10:25:03,060 INFO driver.impl :: Registered driver :mysql (parents: [:sql-jdbc])
2021-11-29 10:25:03,763 INFO driver.impl :: Registered driver :postgres (parents: [:sql-jdbc])
2021-11-29 10:25:06,190 INFO metabase.core ::
Metabase v0.41.1 (76aa4a5 release-x.41.x)

Copyright © 2021 Metabase, Inc.

Metabase Enterprise Edition extensions are NOT PRESENT.
2021-11-29 10:25:06,199 WARN metabase.core :: WARNING: You have enabled namespace tracing, which could log sensitive information like db passwords.
2021-11-29 10:25:06,200 INFO metabase.core :: Starting Metabase in STANDALONE mode
2021-11-29 10:25:06,239 INFO metabase.server :: Launching Embedded Jetty Webserver with config:
{:port 3000}

2021-11-29 10:25:06,295 INFO metabase.core :: Starting Metabase version v0.41.1 (76aa4a5 release-x.41.x) ...
2021-11-29 10:25:06,359 INFO metabase.core :: System info:
{"file.encoding" "Cp1252",
"java.runtime.name" "OpenJDK Runtime Environment",
"java.runtime.version" "11.0.12+7",
"java.vendor" "Eclipse Foundation",
"java.vendor.url" "https://adoptium.net/",
"java.version" "11.0.12",
"java.vm.name" "OpenJDK 64-Bit Server VM",
"java.vm.version" "11.0.12+7",
"os.name" "Windows Server 2012 R2",
"os.version" "6.3",
"user.language" "en",
"user.timezone" "America/Regina"}

2021-11-29 10:25:06,364 INFO metabase.plugins :: Loading plugins in C:\Program Files\Metabase\plugins...
2021-11-29 10:25:06,783 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :bigquery-cloud-sdk...
2021-11-29 10:25:06,795 INFO driver.impl :: Registered driver :bigquery-cloud-sdk (parents: [:sql])
2021-11-29 10:25:06,804 INFO plugins.dependencies :: Plugin 'Metabase BigQuery Driver' depends on plugin 'Metabase Google Drivers Shared Dependencies'
2021-11-29 10:25:06,805 INFO plugins.dependencies :: Metabase BigQuery Driver dependency {:plugin Metabase Google Drivers Shared Dependencies} satisfied? false
2021-11-29 10:25:06,806 INFO plugins.dependencies :: Plugins with unsatisfied deps: ["Metabase BigQuery Driver"]
2021-11-29 10:25:06,813 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :druid...
2021-11-29 10:25:06,814 INFO driver.impl :: Registered driver :druid
2021-11-29 10:25:06,818 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :google...
2021-11-29 10:25:06,819 INFO driver.impl :: Registered abstract driver :google
2021-11-29 10:25:06,820 INFO plugins.dependencies :: Metabase BigQuery Driver dependency {:plugin Metabase Google Drivers Shared Dependencies} satisfied? true
2021-11-29 10:25:06,820 DEBUG plugins.initialize :: Dependencies satisfied; these plugins will now be loaded: ["Metabase BigQuery Driver"]
2021-11-29 10:25:06,821 WARN plugins.lazy-loaded-driver :: Warning: plugin manifest for :bigquery does not include connection properties
2021-11-29 10:25:06,821 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :bigquery...
2021-11-29 10:25:06,822 INFO driver.impl :: Registered driver :bigquery (parents: [:sql :google])
2021-11-29 10:25:06,828 INFO plugins.dependencies :: Plugin 'Metabase Google Analytics Driver' depends on plugin 'Metabase Google Drivers Shared Dependencies'
2021-11-29 10:25:06,829 INFO plugins.dependencies :: Metabase Google Analytics Driver dependency {:plugin Metabase Google Drivers Shared Dependencies} satisfied? true
2021-11-29 10:25:06,830 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :googleanalytics...
2021-11-29 10:25:06,830 INFO driver.impl :: Registered driver :googleanalytics (parents: [:google])
2021-11-29 10:25:06,839 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :mongo...
2021-11-29 10:25:06,839 INFO driver.impl :: Registered driver :mongo
2021-11-29 10:25:06,846 INFO plugins.dependencies :: Metabase cannot initialize plugin Metabase Oracle Driver due to required dependencies. Metabase requires the Oracle JDBC driver in order to connect to Oracle databases, but we can't ship it as part of Metabase due to licensing restrictions. See https://metabase.com/docs/latest/administration-guide/databases/oracle.html for more details.

2021-11-29 10:25:06,846 INFO plugins.dependencies :: Metabase Oracle Driver dependency {:class oracle.jdbc.OracleDriver} satisfied? false
2021-11-29 10:25:06,847 INFO plugins.dependencies :: Plugins with unsatisfied deps: ["Metabase Oracle Driver"]
2021-11-29 10:25:06,850 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :presto-common...
2021-11-29 10:25:06,850 INFO driver.impl :: Registered abstract driver :presto-common
2021-11-29 10:25:06,862 INFO plugins.dependencies :: Plugin 'Metabase Presto JDBC Driver' depends on plugin 'Presto Common Driver'
2021-11-29 10:25:06,863 INFO plugins.dependencies :: Metabase Presto JDBC Driver dependency {:plugin Presto Common Driver} satisfied? true
2021-11-29 10:25:06,863 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :presto-jdbc...
2021-11-29 10:25:06,864 INFO driver.impl :: Registered driver :presto-jdbc (parents: [:presto-common])
2021-11-29 10:25:06,868 INFO plugins.dependencies :: Plugin 'Metabase Presto Driver' depends on plugin 'Presto Common Driver'
2021-11-29 10:25:06,868 INFO plugins.dependencies :: Metabase Presto Driver dependency {:plugin Presto Common Driver} satisfied? true
2021-11-29 10:25:06,869 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :presto...
2021-11-29 10:25:06,869 INFO driver.impl :: Registered driver :presto (parents: [:presto-common])
2021-11-29 10:25:06,874 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :redshift...
2021-11-29 10:25:06,875 INFO driver.impl :: Registered driver :redshift (parents: [:postgres])
2021-11-29 10:25:06,893 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :snowflake...
2021-11-29 10:25:06,894 INFO driver.impl :: Registered driver :snowflake (parents: [:sql-jdbc])
2021-11-29 10:25:06,919 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :hive-like...
2021-11-29 10:25:06,920 INFO driver.impl :: Registered abstract driver :hive-like (parents: [:sql-jdbc])
2021-11-29 10:25:06,920 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :sparksql...
2021-11-29 10:25:06,921 INFO driver.impl :: Registered driver :sparksql (parents: [:hive-like])
2021-11-29 10:25:06,926 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :sqlite...
2021-11-29 10:25:06,927 INFO driver.impl :: Registered driver :sqlite (parents: [:sql-jdbc])
2021-11-29 10:25:06,933 DEBUG plugins.lazy-loaded-driver :: Registering lazy loading driver :sqlserver...
2021-11-29 10:25:06,933 INFO driver.impl :: Registered driver :sqlserver (parents: [:sql-jdbc])
2021-11-29 10:25:06,938 INFO plugins.dependencies :: Metabase cannot initialize plugin Metabase Vertica Driver due to required dependencies. Metabase requires the Vertica JDBC driver in order to connect to Vertica databases, but we can't ship it as part of Metabase due to licensing restrictions. See https://metabase.com/docs/latest/administration-guide/databases/vertica.html for more details.

2021-11-29 10:25:06,939 INFO plugins.dependencies :: Metabase Vertica Driver dependency {:class com.vertica.jdbc.Driver} satisfied? false
2021-11-29 10:25:06,939 INFO plugins.dependencies :: Plugins with unsatisfied deps: ["Metabase Oracle Driver" "Metabase Vertica Driver"]
2021-11-29 10:25:06,940 INFO metabase.core :: Setting up and migrating Metabase DB. Please sit tight, this may take a minute...
2021-11-29 10:25:06,943 INFO db.setup :: Verifying mysql Database Connection ...
2021-11-29 10:25:07,003 ERROR metabase.core :: Metabase Initialization FAILED
clojure.lang.ExceptionInfo: Unable to connect to Metabase mysql DB. {}
at metabase.db.setup$fn__33707$verify_db_connection__33712$fn__33713$fn__33714.invoke(setup.clj:102)
at metabase.db.setup$fn__33707$verify_db_connection__33712$fn__33713.invoke(setup.clj:100)
at metabase.db.setup$fn__33707$verify_db_connection__33712.invoke(setup.clj:94)
at metabase.db.setup$setup_db_BANG_$fn__33742$fn__33743.invoke(setup.clj:142)
at metabase.util$do_with_us_locale.invokeStatic(util.clj:694)
at metabase.util$do_with_us_locale.invoke(util.clj:680)
at metabase.db.setup$setup_db_BANG_$fn__33742.invoke(setup.clj:141)
at metabase.db.setup$setup_db_BANG_.invokeStatic(setup.clj:140)
at metabase.db.setup$setup_db_BANG_.invoke(setup.clj:136)
at metabase.db$setup_db_BANG_$fn__33850.invoke(db.clj:61)
at metabase.db$setup_db_BANG_.invokeStatic(db.clj:56)
at metabase.db$setup_db_BANG_.invoke(db.clj:51)
at metabase.core$init_BANG_.invokeStatic(core.clj:91)
at metabase.core$init_BANG_.invoke(core.clj:74)
at metabase.core$start_normally.invokeStatic(core.clj:135)
at metabase.core$start_normally.invoke(core.clj:129)
at metabase.core$main.invokeStatic(core.clj:168)
at metabase.core$main.doInvoke(core.clj:162)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at metabase.core.main(Unknown Source)
Caused by: java.sql.SQLTransientConnectionException: Could not connect to address=(host=localhost)(port=3306)(type=master) : RSA public key is not available client side (option serverRsaPublicKeyFile not set)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:79)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:192)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1372)
at org.mariadb.jdbc.internal.util.Utils.retrieveProxy(Utils.java:635)
at org.mariadb.jdbc.MariaDbConnection.newConnection(MariaDbConnection.java:150)
at org.mariadb.jdbc.Driver.connect(Driver.java:89)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:189)
at clojure.java.jdbc$get_driver_connection.invokeStatic(jdbc.clj:271)
at clojure.java.jdbc$get_driver_connection.invoke(jdbc.clj:250)
at clojure.java.jdbc$get_connection.invokeStatic(jdbc.clj:411)
at clojure.java.jdbc$get_connection.invoke(jdbc.clj:274)
at clojure.java.jdbc$db_query_with_resultset_STAR
.invokeStatic(jdbc.clj:1111)
at clojure.java.jdbc$db_query_with_resultset_STAR
.invoke(jdbc.clj:1093)
at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1182)
at clojure.java.jdbc$query.invoke(jdbc.clj:1144)
at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1160)
at clojure.java.jdbc$query.invoke(jdbc.clj:1144)
at metabase.driver.sql_jdbc.connection$can_connect_with_spec_QMARK_.invokeStatic(connection.clj:240)
at metabase.driver.sql_jdbc.connection$can_connect_with_spec_QMARK_.invoke(connection.clj:237)
at metabase.db.setup$fn__33707$verify_db_connection__33712$fn__33713$fn__33714.invoke(setup.clj:100)
... 21 more
Caused by: java.sql.SQLException: RSA public key is not available client side (option serverRsaPublicKeyFile not set)
at org.mariadb.jdbc.internal.com.send.authentication.CachingSha2PasswordPlugin.process(CachingSha2PasswordPlugin.java:189)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.authenticationHandler(AbstractConnectProtocol.java:745)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.createConnection(AbstractConnectProtocol.java:546)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1367)
... 39 more
2021-11-29 10:25:07,016 INFO metabase.core :: Metabase Shutting Down ...
2021-11-29 10:25:07,018 INFO metabase.server :: Shutting Down Embedded Jetty Webserver
2021-11-29 10:25:07,065 INFO metabase.core :: Metabase Shutdown COMPLETE

Hi @mloria823
It's not a problem with Java, but the MySQL application database
Unable to connect to Metabase mysql DB: RSA public key is not available client side
https://www.metabase.com/docs/latest/administration-guide/databases/mysql.html
https://github.com/metabase/metabase/issues/12545#issuecomment-629320966

Thank you, for pointing out the error and how to solve it!