[Solved] Error starting postgres driver: metabase.util.i18n.UserLocalizedString cannot be cast to class java.lang.String

I was trying to solve this problem ([Solved] Question about migrating from H2 to Postgres) and now I can’t start Metabase with Postgre anymore.

The error occurs both when trying to start from Postgre and when trying to migrate from H2 to Postgre.

I was trying:
umtb@umtb-VirtualBox:~$ cd METABASE/
umtb@umtb-VirtualBox:~/METABASE$ export MB_DB_TYPE=postgres
umtb@umtb-VirtualBox:~/METABASE$ export MB_DB_DBNAME=db_metabase
umtb@umtb-VirtualBox:~/METABASE$ export MB_DB_PORT=5432
umtb@umtb-VirtualBox:~/METABASE$ export MB_DB_USER=postgres
umtb@umtb-VirtualBox:~/METABASE$ export MB_DB_PASS=01239
umtb@umtb-VirtualBox:~/METABASE$ export MB_DB_HOST=localhost

umtb@umtb-VirtualBox:~/METABASE$ java -jar metabase.jar
or
java -jar metabase.jar load-from-h2 /home/umtb/METABASE/

return the same error:

08-08 15:07:10 ERROR metabase.core :: A Inicialização do Metabase FALHOU
java.lang.ClassCastException: class metabase.util.i18n.UserLocalizedString cannot be cast to class java.lang.String (metabase.util.i18n.UserLocalizedString is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap')

Environment:
Xubuntu 18.04.2
Java:
openjdk version “11.0.4” 2019-07-16
OpenJDK Runtime Environment (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3)
OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3, mixed mode, sharing)

LOG:

umtb@umtb-VirtualBox:~$ cd METABASE/
umtb@umtb-VirtualBox:~/METABASE$ export MB_DB_TYPE=postgres
umtb@umtb-VirtualBox:~/METABASE$ export MB_DB_DBNAME=db_metabase
umtb@umtb-VirtualBox:~/METABASE$ export MB_DB_PORT=5432
umtb@umtb-VirtualBox:~/METABASE$ export MB_DB_USER=postgres
umtb@umtb-VirtualBox:~/METABASE$ export MB_DB_PASS=01239
umtb@umtb-VirtualBox:~/METABASE$ export MB_DB_HOST=localhost
umtb@umtb-VirtualBox:~/METABASE$ java -jar metabase.jar
08-08 15:06:39 DEBUG plugins.classloader :: Using NEWLY CREATED classloader as shared context classloader: clojure.lang.DynamicClassLoader@cf518cf
08-08 15:06:39 DEBUG plugins.classloader :: Definindo carregador de classe de contexto atual para o carregador de classe compartilhado clojure.lang.DynamicClassLoader@cf518cf…
08-08 15:06:40 INFO metabase.util :: Carregando o Metabase…
08-08 15:06:40 INFO metabase.util :: Memória máxima disponível para a JVM: 481,4 MB
08-08 15:06:47 INFO util.encryption :: A criptografia para as credencias salvas é desativada nessa instância Metabase. :unlock:
Para mais informação, veja https://metabase.com/docs/latest/operations-guide/start.html#encrypting-your-database-connection-details-at-rest
08-08 15:06:54 INFO metabase.driver :: Driver abstrato registrado :sql :truck:
08-08 15:07:06 INFO metabase.core :: Iniciando o Metabase no modo INDIVIDUAL
08-08 15:07:06 INFO metabase.server :: Iniciando o servidor web Jetty incluído com a configuração:
{:port 3000}

08-08 15:07:06 INFO metabase.core :: Iniciando o Metabase versão v0.32.10 (5d40681 release-0.32.x) …
08-08 15:07:06 INFO metabase.core :: O fuzo horário do sistema é ‘America/Sao_Paulo’ …
08-08 15:07:06 INFO metabase.plugins :: Carregando plugins em /home/umtb/METABASE/plugins…
08-08 15:07:07 INFO plugins.lazy-loaded-driver :: Registrando Metabase driver :mongo…
08-08 15:07:07 INFO metabase.driver :: Driver registrado :mongo :truck:
08-08 15:07:07 INFO plugins.dependencies :: Plugin “Metabase Google Analytics Driver” depende do plugin “Metabase Google Drivers Shared Dependencies”
08-08 15:07:07 INFO plugins.dependencies :: Metabase Google Analytics Driver dependência(s) {:plugin Metabase Google Drivers Shared Dependencies} satisfeita(s)? false
08-08 15:07:07 INFO plugins.dependencies :: Plugins com deps não satisfeitas: [“Metabase Google Analytics Driver”]
08-08 15:07:07 INFO plugins.lazy-loaded-driver :: Registrando Metabase driver :druid…
08-08 15:07:07 INFO metabase.driver :: Driver registrado :druid :truck:
08-08 15:07:07 INFO plugins.lazy-loaded-driver :: Registrando Metabase driver :redshift…
08-08 15:07:07 INFO metabase.driver :: Driver abstrato registrado :sql-jdbc (pais: [:sql]) :truck:
Carregar driver :sql-jdbc took 9 ms
08-08 15:07:07 INFO metabase.driver :: Driver registrado :postgres (pais: [:sql-jdbc]) :truck:
Carregar driver :postgres took 157 ms
08-08 15:07:07 INFO metabase.driver :: Driver registrado :redshift (pais: [:postgres]) :truck:
08-08 15:07:07 INFO plugins.lazy-loaded-driver :: Registrando Metabase driver :presto…
08-08 15:07:07 INFO metabase.driver :: Driver registrado :presto (pais: [:sql]) :truck:
08-08 15:07:08 INFO plugins.lazy-loaded-driver :: Registrando Metabase driver :google…
08-08 15:07:08 INFO metabase.driver :: Driver abstrato registrado :google :truck:
08-08 15:07:08 INFO plugins.dependencies :: Metabase Google Analytics Driver dependência(s) {:plugin Metabase Google Drivers Shared Dependencies} satisfeita(s)? true
08-08 15:07:08 DEBUG plugins.initialize :: Dependências satisfeitas; estes plugins serão agora carregados: [“Metabase Google Analytics Driver”]
08-08 15:07:08 INFO plugins.lazy-loaded-driver :: Registrando Metabase driver :googleanalytics…
08-08 15:07:08 INFO metabase.driver :: Driver registrado :googleanalytics (pais: [:google]) :truck:
08-08 15:07:08 INFO plugins.lazy-loaded-driver :: Registrando Metabase driver :sqlserver…
08-08 15:07:08 INFO metabase.driver :: Driver registrado :sqlserver (pais: [:sql-jdbc]) :truck:
08-08 15:07:08 INFO plugins.dependencies :: Metabase não pode inicializar o plugin Metabase Vertica Driver devido a dependências requeridas. 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.

08-08 15:07:08 INFO plugins.dependencies :: Metabase Vertica Driver dependência(s) {:class com.vertica.jdbc.Driver} satisfeita(s)? false
08-08 15:07:08 INFO plugins.dependencies :: Plugins com deps não satisfeitas: [“Metabase Vertica Driver”]
08-08 15:07:08 INFO plugins.dependencies :: Metabase não pode inicializar o plugin Metabase Oracle Driver devido a dependências requeridas. 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.

08-08 15:07:08 INFO plugins.dependencies :: Metabase Oracle Driver dependência(s) {:class oracle.jdbc.OracleDriver} satisfeita(s)? false
08-08 15:07:08 INFO plugins.dependencies :: Plugins com deps não satisfeitas: [“Metabase Vertica Driver” “Metabase Oracle Driver”]
08-08 15:07:08 INFO plugins.lazy-loaded-driver :: Registrando Metabase driver :hive-like…
08-08 15:07:08 INFO metabase.driver :: Driver abstrato registrado :hive-like (pais: [:sql-jdbc]) :truck:
08-08 15:07:08 INFO plugins.lazy-loaded-driver :: Registrando Metabase driver :sparksql…
08-08 15:07:08 INFO metabase.driver :: Driver registrado :sparksql (pais: [:hive-like]) :truck:
08-08 15:07:08 INFO plugins.lazy-loaded-driver :: Registrando Metabase driver :sqlite…
08-08 15:07:08 INFO metabase.driver :: Driver registrado :sqlite (pais: [:sql-jdbc]) :truck:
08-08 15:07:08 INFO plugins.lazy-loaded-driver :: Registrando Metabase driver :snowflake…
08-08 15:07:08 INFO metabase.driver :: Driver registrado :snowflake (pais: [:sql-jdbc]) :truck:
08-08 15:07:08 INFO plugins.dependencies :: Plugin “Metabase BigQuery Driver” depende do plugin “Metabase Google Drivers Shared Dependencies”
08-08 15:07:08 INFO plugins.dependencies :: Metabase BigQuery Driver dependência(s) {:plugin Metabase Google Drivers Shared Dependencies} satisfeita(s)? true
08-08 15:07:08 INFO plugins.lazy-loaded-driver :: Registrando Metabase driver :bigquery…
08-08 15:07:08 INFO metabase.driver :: Driver registrado :bigquery (pais: [:sql :google]) :truck:
08-08 15:07:09 INFO metabase.driver :: Driver registrado :mysql (pais: [:sql-jdbc]) :truck:
Carregar driver :mysql took 52 ms
08-08 15:07:09 INFO metabase.driver :: Driver registrado :h2 (pais: [:sql-jdbc]) :truck:
Carregar driver :h2 took 46 ms
08-08 15:07:09 INFO metabase.core :: Configurando e migrando o BD do Metabase. Por favor aguarde, isso pode demorar alguns minutos.
08-08 15:07:10 INFO metabase.db :: Verifying postgres Database Connection …
08-08 15:07:10 INFO metabase.driver :: Initializing driver :sql…
08-08 15:07:10 INFO metabase.driver :: Initializing driver :sql-jdbc…
08-08 15:07:10 INFO metabase.driver :: Initializing driver :postgres…
08-08 15:07:10 ERROR metabase.core :: A Inicialização do Metabase FALHOU
java.lang.ClassCastException: class metabase.util.i18n.UserLocalizedString cannot be cast to class java.lang.String (metabase.util.i18n.UserLocalizedString is in unnamed module of loader ‘app’; java.lang.String is in module java.base of loader ‘bootstrap’)
at metabase.driver.util$can_connect_with_details_QMARK_.invokeStatic(util.clj:34)
at metabase.driver.util$can_connect_with_details_QMARK_.doInvoke(util.clj:18)
at clojure.lang.RestFn.invoke(RestFn.java:442)
at clojure.lang.Var.invoke(Var.java:393)
at metabase.db$fn__16327$verify_db_connection__16336$fn__16339$fn__16340.invoke(db.clj:404)
at metabase.db$fn__16327$verify_db_connection__16336$fn__16339.invoke(db.clj:402)
at metabase.db$fn__16327$verify_db_connection__16336.invoke(db.clj:395)
at metabase.db$fn__16327$verify_db_connection__16336$fn__16337.invoke(db.clj:398)
at metabase.db$fn__16327$verify_db_connection__16336.invoke(db.clj:395)
at metabase.db$setup_db_BANG__STAR_$fn__16372.invoke(db.clj:467)
at metabase.util$do_with_us_locale.invokeStatic(util.clj:675)
at metabase.util$do_with_us_locale.invoke(util.clj:661)
at metabase.db$setup_db_BANG__STAR_.invokeStatic(db.clj:466)
at metabase.db$setup_db_BANG__STAR_.invoke(db.clj:462)
at metabase.db$fn__16376$fn__16377.invoke(db.clj:477)
at clojure.lang.Delay.deref(Delay.java:42)
at clojure.core$deref.invokeStatic(core.clj:2320)
at clojure.core$deref.invoke(core.clj:2306)
at clojure.core$partial$fn__5839.invoke(core.clj:2623)
at metabase.core$init_BANG_.invokeStatic(core.clj:76)
at metabase.core$init_BANG_.invoke(core.clj:55)
at metabase.core$start_normally.invokeStatic(core.clj:122)
at metabase.core$start_normally.invoke(core.clj:116)
at metabase.core$_main.invokeStatic(core.clj:142)
at metabase.core$_main.doInvoke(core.clj:137)
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)
08-08 15:07:10 INFO metabase.core :: O Metabase está desligando…
08-08 15:07:10 INFO metabase.server :: Desligando o servidor web Jetty
08-08 15:07:10 INFO metabase.core :: Desligamento do Metabase COMPLETO
umtb@umtb-VirtualBox:~/METABASE$

Hi @juliozillo
You’re seeing a couple of different problems.
Number one, you should not use load-from-h2 unless you’re migrating away from H2, so since you have already migrated, then don’t use that anymore.
The error you’re seeing is a really bad message - and there’s already an issue open on this - #10347
It’s most likely because the connection to the database fails - so verify that all the MB_DB_*** details are correct, specifically database, user and password.
Is the Postgres available from inside the Xubuntu VM on localhost:5432 ?
Also, it looks like the VM has very limited amount of RAM - this might crash Java or Postgres, when you start using Metabase, so you might want to give the VM a bit more.

Hi flamber, thanks for the help.

Yesterday I migrated from H2 to Postgre correctly (all tables were created in Postgre) but after the other problem I mentioned I am not getting it anymore.

I have doubled the memory of my VM and I will try to start from scratch with a new jar and configure with H2 and only then try to migrate again.

Apparently, some attempts to change Postgre user password have confused me, because the password I am accessing from pgAdmin is different from the password I access via command line.

Thanks for your help, and after I found myself in my passwords I was able to proceed.

1 Like