charts icon indicating copy to clipboard operation
charts copied to clipboard

[bitnami/keycloak] Could not obtain connection to query metadata: java.sql.SQLException: No suitable driver found for

Open HujinoKun opened this issue 2 years ago • 17 comments

Name and Version

bitnami/keycloak 9.3.2

What steps will reproduce the bug?

Hello,

by updating the helm chart and the keycloak version (16 to 18), I have the following problem :

2022-06-29 12:23:28,998 WARN  [io.quarkus.netty.runtime.NettyRecorder] (Thread-0) Netty DefaultChannelId initialization (with io.netty.machineId system property set to dc:1f:63:eb:14:13:04:bc) took more than a second
2022-06-29 12:23:32,593 WARN  [io.quarkus.runtime.configuration.ConfigRecorder] (main) Build time property cannot be changed at runtime:
 - quarkus.datasource.jdbc.driver is set to 'org.h2.jdbcx.JdbcDataSource' but it is build time fixed to 'org.postgresql.xa.PGXADataSource'. Did you change the property quarkus.datasource.jdbc.driver after building the application?
2022-06-29 12:23:35,597 INFO  [org.keycloak.quarkus.runtime.hostname.DefaultHostnameProvider] (main) Hostname settings: FrontEnd: <request>, Strict HTTPS: true, Path: <request>, Strict BackChannel: false, Admin: <request>, Port: -1, Proxied: true
2022-06-29 12:23:37,900 WARN  [io.agroal.pool] (agroal-11) Datasource '<default>': No suitable driver found for jdbc:postgresql://postgres.databases.svc.cluster.local:5432/keycloak_prod?currentSchema=public
2022-06-29 12:23:37,992 WARN  [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator] (JPA Startup Thread: keycloak-default) HHH000342: Could not obtain connection to query metadata: java.sql.SQLException: No suitable driver found for jdbc:postgresql://postgres.databases.svc.cluster.local:5432/keycloak_prod?currentSchema=public
        at org.h2.jdbcx.JdbcDataSource.getJdbcConnection(JdbcDataSource.java:191)
        at org.h2.jdbcx.JdbcDataSource.getXAConnection(JdbcDataSource.java:352)
        at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:216)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:513)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:494)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1126)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

2022-06-29 12:23:47,900 WARN  [io.agroal.pool] (agroal-11) Datasource '<default>': No suitable driver found for jdbc:postgresql://postgres.databases.svc.cluster.local:5432/keycloak_prod?currentSchema=public
2022-06-29 12:23:49,199 WARN  [org.infinispan.CONFIG] (keycloak-cache-init) ISPN000569: Unable to persist Infinispan internal caches as no global state enabled
2022-06-29 12:23:49,299 WARN  [org.infinispan.PERSISTENCE] (keycloak-cache-init) ISPN000554: jboss-marshalling is deprecated and planned for removal
2022-06-29 12:23:49,492 INFO  [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000556: Starting user marshaller 'org.infinispan.jboss.marshalling.core.JBossUserMarshaller'
2022-06-29 12:23:51,203 INFO  [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000128: Infinispan version: Infinispan 'Triskaidekaphobia' 13.0.9.Final
2022-06-29 12:23:52,092 INFO  [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000078: Starting JGroups channel `ISPN`
2022-06-29 12:23:52,092 INFO  [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000088: Unable to use any JGroups configuration mechanisms provided in properties {}. Using default JGroups configuration!
2022-06-29 12:23:52,897 WARN  [org.jgroups.protocols.UDP] (keycloak-cache-init) JGRP000015: the send buffer of socket MulticastSocket was set to 1.00MB, but the OS only allocated 212.99KB
2022-06-29 12:23:52,897 WARN  [org.jgroups.protocols.UDP] (keycloak-cache-init) JGRP000015: the receive buffer of socket MulticastSocket was set to 20.00MB, but the OS only allocated 212.99KB      
2022-06-29 12:23:52,900 WARN  [org.jgroups.protocols.UDP] (keycloak-cache-init) JGRP000015: the send buffer of socket MulticastSocket was set to 1.00MB, but the OS only allocated 212.99KB
2022-06-29 12:23:52,900 WARN  [org.jgroups.protocols.UDP] (keycloak-cache-init) JGRP000015: the receive buffer of socket MulticastSocket was set to 25.00MB, but the OS only allocated 212.99KB      
2022-06-29 12:23:55,095 INFO  [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) keycloak-0-65321: no members discovered after 2005 ms: creating cluster as coordinator
2022-06-29 12:23:55,108 INFO  [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000094: Received new cluster view for channel ISPN: [keycloak-0-65321|0] (1) [keycloak-0-65321]
2022-06-29 12:23:55,113 INFO  [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000079: Channel `ISPN` local address is `keycloak-0-65321`, physical addresses are `[10.42.0.89:48179]`
2022-06-29 12:24:00,199 INFO  [org.infinispan.CLUSTER] (main) ISPN000080: Disconnecting JGroups channel `ISPN`
2022-06-29 12:24:00,994 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to start server in (production) mode
2022-06-29 12:24:00,994 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to obtain JDBC connection
2022-06-29 12:24:00,995 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: No suitable driver found for jdbc:postgresql://postgres.databases.svc.cluster.local:5432/keycloak_prod?currentSchema=public
2022-06-29 12:24:00,996 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) For more details run the same command passing the '--verbose' option. Also you can use '--help' to see the details about the usage of the particular command.

Are you using any custom parameters or values?

image:
  registry: docker.io
  repository: bitnami/keycloak
  tag: 18.0.2-debian-11-r1
  tls:
    enabled: true
    autoGenerated: true
    usePem: true
proxy: reencrypt
extraEnvVars:
  - name: KEYCLOAK_PRODUCTION
    value: "true"
  - name: KC_DB
    value: "postgres"
cache:
  enabled: false
externalDatabase:
  host: "postgres.databases.svc.cluster.local"
  port: 5432
  user: "u_keycloak_prod"
  database: "keycloak_prod"
  password: ""
  existingSecret: "keycloak-secrets"
  existingSecretPasswordKey: "postgresql-password"

What is the expected behavior?

No response

What do you see instead?

k logs -f sts/keycloak
Defaulted container "keycloak" out of: keycloak, init-certs (init)
keycloak 12:23:00.43 
keycloak 12:23:00.43 Welcome to the Bitnami keycloak container
keycloak 12:23:00.44 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-keycloak
keycloak 12:23:00.44 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-keycloak/issues
keycloak 12:23:00.44
keycloak 12:23:00.44 INFO  ==> ** Starting keycloak setup **
keycloak 12:23:00.50 INFO  ==> Validating settings in KEYCLOAK_* env vars...
keycloak 12:23:00.51 INFO  ==> Trying to connect to PostgreSQL server postgres.databases.svc.cluster.local...
keycloak 12:23:00.59 INFO  ==> Found PostgreSQL server listening at postgres.databases.svc.cluster.local:5432
keycloak 12:23:00.60 INFO  ==> Configuring database settings
keycloak 12:23:00.69 INFO  ==> Enabling statistics
keycloak 12:23:00.70 INFO  ==> Configuring http settings
keycloak 12:23:00.80 INFO  ==> Configuring hostname settings
keycloak 12:23:00.80 INFO  ==> Configuring cache count
keycloak 12:23:00.81 INFO  ==> Configuring log level
keycloak 12:23:00.90 INFO  ==> Configuring proxy
keycloak 12:23:00.90 INFO  ==> Configuring TLS by setting keystore and truststore
keycloak 12:23:01.00 INFO  ==> ** keycloak setup finished! **

keycloak 12:23:01.09 INFO  ==> ** Starting keycloak **
2022-06-29 12:23:28,998 WARN  [io.quarkus.netty.runtime.NettyRecorder] (Thread-0) Netty DefaultChannelId initialization (with io.netty.machineId system property set to dc:1f:63:eb:14:13:04:bc) took more than a second
2022-06-29 12:23:32,593 WARN  [io.quarkus.runtime.configuration.ConfigRecorder] (main) Build time property cannot be changed at runtime:
 - quarkus.datasource.jdbc.driver is set to 'org.h2.jdbcx.JdbcDataSource' but it is build time fixed to 'org.postgresql.xa.PGXADataSource'. Did you change the property quarkus.datasource.jdbc.driver after building the application?
2022-06-29 12:23:35,597 INFO  [org.keycloak.quarkus.runtime.hostname.DefaultHostnameProvider] (main) Hostname settings: FrontEnd: <request>, Strict HTTPS: true, Path: <request>, Strict BackChannel: false, Admin: <request>, Port: -1, Proxied: true
2022-06-29 12:23:37,900 WARN  [io.agroal.pool] (agroal-11) Datasource '<default>': No suitable driver found for jdbc:postgresql://postgres.databases.svc.cluster.local:5432/keycloak_prod?currentSchema=public
2022-06-29 12:23:37,992 WARN  [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator] (JPA Startup Thread: keycloak-default) HHH000342: Could not obtain connection to query metadata: java.sql.SQLException: No suitable driver found for jdbc:postgresql://postgres.databases.svc.cluster.local:5432/keycloak_prod?currentSchema=public
        at org.h2.jdbcx.JdbcDataSource.getJdbcConnection(JdbcDataSource.java:191)
        at org.h2.jdbcx.JdbcDataSource.getXAConnection(JdbcDataSource.java:352)
        at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:216)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:513)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:494)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1126)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

2022-06-29 12:23:47,900 WARN  [io.agroal.pool] (agroal-11) Datasource '<default>': No suitable driver found for jdbc:postgresql://postgres.databases.svc.cluster.local:5432/keycloak_prod?currentSchema=public
2022-06-29 12:23:49,199 WARN  [org.infinispan.CONFIG] (keycloak-cache-init) ISPN000569: Unable to persist Infinispan internal caches as no global state enabled
2022-06-29 12:23:49,299 WARN  [org.infinispan.PERSISTENCE] (keycloak-cache-init) ISPN000554: jboss-marshalling is deprecated and planned for removal
2022-06-29 12:23:49,492 INFO  [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000556: Starting user marshaller 'org.infinispan.jboss.marshalling.core.JBossUserMarshaller'
2022-06-29 12:23:51,203 INFO  [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000128: Infinispan version: Infinispan 'Triskaidekaphobia' 13.0.9.Final
2022-06-29 12:23:52,092 INFO  [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000078: Starting JGroups channel `ISPN`
2022-06-29 12:23:52,092 INFO  [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000088: Unable to use any JGroups configuration mechanisms provided in properties {}. Using default JGroups configuration!
2022-06-29 12:23:52,897 WARN  [org.jgroups.protocols.UDP] (keycloak-cache-init) JGRP000015: the send buffer of socket MulticastSocket was set to 1.00MB, but the OS only allocated 212.99KB
2022-06-29 12:23:52,897 WARN  [org.jgroups.protocols.UDP] (keycloak-cache-init) JGRP000015: the receive buffer of socket MulticastSocket was set to 20.00MB, but the OS only allocated 212.99KB      
2022-06-29 12:23:52,900 WARN  [org.jgroups.protocols.UDP] (keycloak-cache-init) JGRP000015: the send buffer of socket MulticastSocket was set to 1.00MB, but the OS only allocated 212.99KB
2022-06-29 12:23:52,900 WARN  [org.jgroups.protocols.UDP] (keycloak-cache-init) JGRP000015: the receive buffer of socket MulticastSocket was set to 25.00MB, but the OS only allocated 212.99KB      
2022-06-29 12:23:55,095 INFO  [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) keycloak-0-65321: no members discovered after 2005 ms: creating cluster as coordinator
2022-06-29 12:23:55,108 INFO  [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000094: Received new cluster view for channel ISPN: [keycloak-0-65321|0] (1) [keycloak-0-65321]
2022-06-29 12:23:55,113 INFO  [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000079: Channel `ISPN` local address is `keycloak-0-65321`, physical addresses are `[10.42.0.89:48179]`
2022-06-29 12:24:00,199 INFO  [org.infinispan.CLUSTER] (main) ISPN000080: Disconnecting JGroups channel `ISPN`
2022-06-29 12:24:00,994 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to start server in (production) mode
2022-06-29 12:24:00,994 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to obtain JDBC connection
2022-06-29 12:24:00,995 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: No suitable driver found for jdbc:postgresql://postgres.databases.svc.cluster.local:5432/keycloak_prod?currentSchema=public
2022-06-29 12:24:00,996 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) For more details run the same command passing the '--verbose' option. Also you can use '--help' to see the details about the usage of the particular command.

Additional information

No response

HujinoKun avatar Jun 29 '22 12:06 HujinoKun

Strange, I've got the same issue on 9.3.3.
9.3.2 is working fine for me.

marknesterovych avatar Jun 30 '22 05:06 marknesterovych

Hi,

Does the issue happen with a fresh installation of the chart?

javsalgar avatar Jun 30 '22 08:06 javsalgar

It was upgrade from 9.2.12

marknesterovych avatar Jun 30 '22 08:06 marknesterovych

It was upgrade from 9.2.12

Yes

HujinoKun avatar Jun 30 '22 09:06 HujinoKun

Hi!

Does it happen in a fresh instance?

javsalgar avatar Jun 30 '22 11:06 javsalgar

I don't have room to install a new instance and there is no way I will destroy my existing keycloak instance

HujinoKun avatar Jun 30 '22 12:06 HujinoKun

Up

HujinoKun avatar Jul 03 '22 15:07 HujinoKun

fresh install : same error

HujinoKun avatar Jul 03 '22 16:07 HujinoKun

Hi!

I tried with a fresh installation and didn't see the issue

» kubectl logs keycloak-0
keycloak 09:44:55.83
keycloak 09:44:55.84 Welcome to the Bitnami keycloak container
keycloak 09:44:55.84 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-keycloak
keycloak 09:44:55.84 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-keycloak/issues
keycloak 09:44:55.84
keycloak 09:44:55.85 INFO  ==> ** Starting keycloak setup **
keycloak 09:44:55.85 INFO  ==> Validating settings in KEYCLOAK_* env vars...
keycloak 09:44:55.86 INFO  ==> Trying to connect to PostgreSQL server keycloak-postgresql...
timeout reached before the port went into state "inuse"
timeout reached before the port went into state "inuse"
keycloak 09:45:25.91 INFO  ==> Found PostgreSQL server listening at keycloak-postgresql:5432
keycloak 09:45:25.91 INFO  ==> Configuring database settings
keycloak 09:45:25.94 INFO  ==> Enabling statistics
keycloak 09:45:25.95 INFO  ==> Configuring http settings
keycloak 09:45:25.97 INFO  ==> Configuring hostname settings
keycloak 09:45:25.97 INFO  ==> Configuring cache count
keycloak 09:45:25.98 INFO  ==> Configuring log level
keycloak 09:45:25.99 INFO  ==> Configuring proxy
keycloak 09:45:26.00 INFO  ==> ** keycloak setup finished! **

keycloak 09:45:26.01 INFO  ==> ** Starting keycloak **
Updating the configuration and installing your custom providers, if any. Please wait.
2022-07-04 09:45:32,755 WARN  [org.keycloak.services] (build-5) KC-SERVICES0047: metrics (org.jboss.aerogear.keycloak.metrics.MetricsEndpointFactory) is implementing the internal SPI realm-restapi-extension. This SPI is internal and may change without notice
2022-07-04 09:45:33,718 WARN  [org.keycloak.services] (build-5) KC-SERVICES0047: metrics-listener (org.jboss.aerogear.keycloak.metrics.MetricsEventListenerFactory) is implementing the internal SPI eventsListener. This SPI is internal and may change without notice
2022-07-04 09:45:38,165 INFO  [io.quarkus.deployment.QuarkusAugmentor] (main) Quarkus augmentation completed in 8961ms
2022-07-04 09:45:42,230 INFO  [org.keycloak.quarkus.runtime.hostname.DefaultHostnameProvider] (main) Hostname settings: FrontEnd: <request>, Strict HTTPS: false, Path: <request>, Strict BackChannel: false, Admin: <request>, Port: -1, Proxied: true
2022-07-04 09:45:44,228 WARN  [org.infinispan.PERSISTENCE] (keycloak-cache-init) ISPN000554: jboss-marshalling is deprecated and planned for removal
2022-07-04 09:45:44,286 WARN  [org.infinispan.CONFIG] (keycloak-cache-init) ISPN000569: Unable to persist Infinispan internal caches as no global state enabled
2022-07-04 09:45:44,314 INFO  [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000556: Starting user marshaller 'org.infinispan.jboss.marshalling.core.JBossUserMarshaller'
2022-07-04 09:45:44,802 INFO  [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000128: Infinispan version: Infinispan 'Triskaidekaphobia' 13.0.9.Final
2022-07-04 09:45:47,733 INFO  [org.keycloak.quarkus.runtime.storage.database.liquibase.QuarkusJpaUpdaterProvider] (main) Initializing database schema. Using changelog META-INF/jpa-changelog-master.xml
2022-07-04 09:45:52,120 INFO  [org.keycloak.connections.infinispan.DefaultInfinispanConnectionProviderFactory] (main) Node name: node_319740, Site name: null
2022-07-04 09:45:52,380 INFO  [org.keycloak.services] (main) KC-SERVICES0050: Initializing master realm
2022-07-04 09:45:56,240 INFO  [org.keycloak.services] (main) KC-SERVICES0009: Added user 'user' to realm 'master'
2022-07-04 09:45:56,395 INFO  [io.quarkus] (main) Keycloak 18.0.2 on JVM (powered by Quarkus 2.7.5.Final) started in 18.011s. Listening on: http://0.0.0.0:8080
2022-07-04 09:45:56,396 INFO  [io.quarkus] (main) Profile dev activated.
2022-07-04 09:45:56,396 INFO  [io.quarkus] (main) Installed features: [agroal, cdi, hibernate-orm, jdbc-h2, jdbc-mariadb, jdbc-mssql, jdbc-mysql, jdbc-oracle, jdbc-postgresql, keycloak, narayana-jta, reactive-routes, resteasy, resteasy-jackson, smallrye-context-propagation, smallrye-health, smallrye-metrics, vault, vertx]
2022-07-04 09:45:56,404 WARN  [org.keycloak.quarkus.runtime.KeycloakMain] (main) Running the server in development mode. DO NOT use this configuration in production.

Any extra steps I should perform?

javsalgar avatar Jul 04 '22 10:07 javsalgar

Hi!

I tried with a fresh installation and didn't see the issue

» kubectl logs keycloak-0
keycloak 09:44:55.83
keycloak 09:44:55.84 Welcome to the Bitnami keycloak container
keycloak 09:44:55.84 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-keycloak
keycloak 09:44:55.84 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-keycloak/issues
keycloak 09:44:55.84
keycloak 09:44:55.85 INFO  ==> ** Starting keycloak setup **
keycloak 09:44:55.85 INFO  ==> Validating settings in KEYCLOAK_* env vars...
keycloak 09:44:55.86 INFO  ==> Trying to connect to PostgreSQL server keycloak-postgresql...
timeout reached before the port went into state "inuse"
timeout reached before the port went into state "inuse"
keycloak 09:45:25.91 INFO  ==> Found PostgreSQL server listening at keycloak-postgresql:5432
keycloak 09:45:25.91 INFO  ==> Configuring database settings
keycloak 09:45:25.94 INFO  ==> Enabling statistics
keycloak 09:45:25.95 INFO  ==> Configuring http settings
keycloak 09:45:25.97 INFO  ==> Configuring hostname settings
keycloak 09:45:25.97 INFO  ==> Configuring cache count
keycloak 09:45:25.98 INFO  ==> Configuring log level
keycloak 09:45:25.99 INFO  ==> Configuring proxy
keycloak 09:45:26.00 INFO  ==> ** keycloak setup finished! **

keycloak 09:45:26.01 INFO  ==> ** Starting keycloak **
Updating the configuration and installing your custom providers, if any. Please wait.
2022-07-04 09:45:32,755 WARN  [org.keycloak.services] (build-5) KC-SERVICES0047: metrics (org.jboss.aerogear.keycloak.metrics.MetricsEndpointFactory) is implementing the internal SPI realm-restapi-extension. This SPI is internal and may change without notice
2022-07-04 09:45:33,718 WARN  [org.keycloak.services] (build-5) KC-SERVICES0047: metrics-listener (org.jboss.aerogear.keycloak.metrics.MetricsEventListenerFactory) is implementing the internal SPI eventsListener. This SPI is internal and may change without notice
2022-07-04 09:45:38,165 INFO  [io.quarkus.deployment.QuarkusAugmentor] (main) Quarkus augmentation completed in 8961ms
2022-07-04 09:45:42,230 INFO  [org.keycloak.quarkus.runtime.hostname.DefaultHostnameProvider] (main) Hostname settings: FrontEnd: <request>, Strict HTTPS: false, Path: <request>, Strict BackChannel: false, Admin: <request>, Port: -1, Proxied: true
2022-07-04 09:45:44,228 WARN  [org.infinispan.PERSISTENCE] (keycloak-cache-init) ISPN000554: jboss-marshalling is deprecated and planned for removal
2022-07-04 09:45:44,286 WARN  [org.infinispan.CONFIG] (keycloak-cache-init) ISPN000569: Unable to persist Infinispan internal caches as no global state enabled
2022-07-04 09:45:44,314 INFO  [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000556: Starting user marshaller 'org.infinispan.jboss.marshalling.core.JBossUserMarshaller'
2022-07-04 09:45:44,802 INFO  [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000128: Infinispan version: Infinispan 'Triskaidekaphobia' 13.0.9.Final
2022-07-04 09:45:47,733 INFO  [org.keycloak.quarkus.runtime.storage.database.liquibase.QuarkusJpaUpdaterProvider] (main) Initializing database schema. Using changelog META-INF/jpa-changelog-master.xml
2022-07-04 09:45:52,120 INFO  [org.keycloak.connections.infinispan.DefaultInfinispanConnectionProviderFactory] (main) Node name: node_319740, Site name: null
2022-07-04 09:45:52,380 INFO  [org.keycloak.services] (main) KC-SERVICES0050: Initializing master realm
2022-07-04 09:45:56,240 INFO  [org.keycloak.services] (main) KC-SERVICES0009: Added user 'user' to realm 'master'
2022-07-04 09:45:56,395 INFO  [io.quarkus] (main) Keycloak 18.0.2 on JVM (powered by Quarkus 2.7.5.Final) started in 18.011s. Listening on: http://0.0.0.0:8080
2022-07-04 09:45:56,396 INFO  [io.quarkus] (main) Profile dev activated.
2022-07-04 09:45:56,396 INFO  [io.quarkus] (main) Installed features: [agroal, cdi, hibernate-orm, jdbc-h2, jdbc-mariadb, jdbc-mssql, jdbc-mysql, jdbc-oracle, jdbc-postgresql, keycloak, narayana-jta, reactive-routes, resteasy, resteasy-jackson, smallrye-context-propagation, smallrye-health, smallrye-metrics, vault, vertx]
2022-07-04 09:45:56,404 WARN  [org.keycloak.quarkus.runtime.KeycloakMain] (main) Running the server in development mode. DO NOT use this configuration in production.

Any extra steps I should perform?

What did you put in the values?

Moreover, you aren't in the production profile of keycloak.

HujinoKun avatar Jul 04 '22 11:07 HujinoKun

Hi!

I was able to reproduce the issue. I will forward this to the engineering team. Thanks for reporting!

javsalgar avatar Jul 06 '22 09:07 javsalgar

Hi!

I was able to reproduce the issue. I will forward this to the engineering team. Thanks for reporting!

Hello,

Any update ?

HujinoKun avatar Jul 16 '22 00:07 HujinoKun

Hi, Sorry, not yet.

rafariossaa avatar Jul 18 '22 07:07 rafariossaa

Hello, I am also interested in this problem that occurs when I upgrade to 9.3.X

CaptainKrby avatar Aug 02 '22 09:08 CaptainKrby

Hi,

Have the same problem after upgrading from version 18.0.1 to 18.0.2.

mshenhera avatar Aug 03 '22 11:08 mshenhera

I am getting the same error while running keycloak in production. Adding --auto-build flag fixed it. However, seems like the flag is deprecated in v19: https://www.keycloak.org/docs/latest/upgrading/#changes-to-the-server-configuration-and-startup

Source:

  • https://github.com/bitnami/containers/issues/983#issuecomment-1197990856
  • https://github.com/bitnami/charts/issues/11067#issuecomment-1177241015

garyng avatar Aug 07 '22 16:08 garyng

Hi, Thanks for coming back. I adding this notes to the task.

rafariossaa avatar Aug 08 '22 08:08 rafariossaa

Hello ! Any progress ?

atanovv avatar Aug 12 '22 02:08 atanovv

I am sorry but no. We will come back as soon as we have news.

rafariossaa avatar Aug 16 '22 07:08 rafariossaa

keycloak 18.0.2

keycloak 15:40:25.48 INFO  ==> ** Starting keycloak **
Unknown option: '--optimized'

Args :

 - name: KEYCLOAK_EXTRA_ARGS
    value: "--optimized"

qdupuy avatar Aug 30 '22 15:08 qdupuy

🖖

🆙

HujinoKun avatar Sep 03 '22 19:09 HujinoKun

Is there any update on this ticket yet? Or what is the suggested workaround as this issue seems to be a blocker for using this Chart for a Production Keycloak installation...

hendrik-schaffer avatar Sep 22 '22 09:09 hendrik-schaffer

Upgrading to the newest major version seems to do the trick :)

tamcore avatar Sep 22 '22 09:09 tamcore

Hello,

Nope,

2022-09-24 13:58:43,191 WARN  [io.agroal.pool] (agroal-11) Datasource '<default>': No suitable driver found for jdbc:postgresql://postgres.databases.svc.cluster.local:5432/keycloak_prod?currentSchema=public
2022-09-24 13:58:44,891 WARN  [org.infinispan.PERSISTENCE] (keycloak-cache-init) ISPN000554: jboss-marshalling is deprecated and planned for removal
2022-09-24 13:58:45,099 WARN  [org.infinispan.CONFIG] (keycloak-cache-init) ISPN000569: Unable to persist Infinispan internal caches as no global state enabled
2022-09-24 13:58:45,397 INFO  [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000556: Starting user marshaller 'org.infinispan.jboss.marshalling.core.JBossUserMarshaller'       
2022-09-24 13:58:48,695 INFO  [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000128: Infinispan version: Infinispan 'Triskaidekaphobia' 13.0.9.Final
2022-09-24 13:58:49,599 INFO  [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000078: Starting JGroups channel `ISPN`
2022-09-24 13:58:49,599 INFO  [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000088: Unable to use any JGroups configuration mechanisms provided in properties {}. Using default JGroups configuration!
2022-09-24 13:58:51,002 WARN  [org.jgroups.protocols.UDP] (keycloak-cache-init) JGRP000015: the send buffer of socket MulticastSocket was set to 1.00MB, but the OS only allocated 212.99KB
2022-09-24 13:58:51,003 WARN  [org.jgroups.protocols.UDP] (keycloak-cache-init) JGRP000015: the receive buffer of socket MulticastSocket was set to 20.00MB, but the OS only allocated 212.99KB
2022-09-24 13:58:51,003 WARN  [org.jgroups.protocols.UDP] (keycloak-cache-init) JGRP000015: the send buffer of socket MulticastSocket was set to 1.00MB, but the OS only allocated 212.99KB
2022-09-24 13:58:51,003 WARN  [org.jgroups.protocols.UDP] (keycloak-cache-init) JGRP000015: the receive buffer of socket MulticastSocket was set to 25.00MB, but the OS only allocated 212.99KB
2022-09-24 13:58:53,194 INFO  [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) keycloak-0-64175: no members discovered after 2093 ms: creating cluster as coordinator
2022-09-24 13:58:53,210 INFO  [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000094: Received new cluster view for channel ISPN: [keycloak-0-64175|0] (1) [keycloak-0-64175]      
2022-09-24 13:58:53,300 INFO  [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000079: Channel `ISPN` local address is `keycloak-0-64175`, physical addresses are `[10.42.0.129:53813]`
2022-09-24 13:59:00,691 INFO  [org.infinispan.CLUSTER] (main) ISPN000080: Disconnecting JGroups channel `ISPN`
2022-09-24 13:59:01,491 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to start server in (production) mode
2022-09-24 13:59:01,492 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to obtain JDBC connection
2022-09-24 13:59:01,492 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: No suitable driver found for jdbc:postgresql://postgres.databases.svc.cluster.local:5432/keycloak_prod?currentSchema=public
2022-09-24 13:59:01,493 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) For more details run the same command passing the '--verbose' option. Also you can use '--help' to see the details about the usage of the particular command.

HujinoKun avatar Sep 24 '22 14:09 HujinoKun

That's weird. Which container version did you try? It worked flawlessy for us and now I'm worried about the next time we update the container (we're running 19.0.2-r0 or something I think).

tamcore avatar Sep 24 '22 14:09 tamcore

    Image:          docker.io/bitnami/keycloak:19.0.2-debian-11-r3
    Image ID:       docker.io/bitnami/keycloak@sha256:a1bfcc096ef0577b2bf1c6b929213033e72a18d14a5f9d268417fcb6f9b4cf4b

HujinoKun avatar Sep 24 '22 14:09 HujinoKun

I'm not able to reproduce the issue using the latest Helm chart version:

$ helm install keycloak -n mynamespace bitnami/keycloak -f values.yaml
NAME: keycloak
LAST DEPLOYED: Tue Sep 27 15:15:58 2022
NAMESPACE: mynamespace
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: keycloak
CHART VERSION: 10.1.2
APP VERSION: 19.0.2
...

$ kubectl get all -n mynamespace
NAME                        READY   STATUS    RESTARTS   AGE
pod/keycloak-0              1/1     Running   0          4m18s
pod/keycloak-postgresql-0   1/1     Running   0          4m18s

NAME                             TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
service/keycloak                 LoadBalancer   10.30.252.59    <pending>     80:32368/TCP,443:32697/TCP   4m18s
service/keycloak-headless        ClusterIP      None            <none>        80/TCP,443/TCP               4m18s
service/keycloak-postgresql      ClusterIP      10.30.242.155   <none>        5432/TCP                     4m18s
service/keycloak-postgresql-hl   ClusterIP      None            <none>        5432/TCP                     4m18s

NAME                                   READY   AGE
statefulset.apps/keycloak              1/1     4m18s
statefulset.apps/keycloak-postgresql   1/1     4m18s

Where values.yaml is

auth:
  tls:
    enabled: true
    autoGenerated: true
    usePem: true
extraEnvVars:
  - name: KEYCLOAK_PRODUCTION
    value: "true"

carrodher avatar Sep 27 '22 15:09 carrodher

We are testing with the following setup:

  • "Optimized" Docker image (https://www.keycloak.org/server/containers#_building_your_optimized_keycloak_docker_image)
  • External PostgreSQL database
  • Cluster mode with more than one replica

Dockerfile

FROM bitnami/keycloak:19.0.2-debian-11-r5 as builder

ENV KC_HEALTH_ENABLED=true
ENV KC_METRICS_ENABLED=true
ENV KC_FEATURES=scripts

# Install custom providers
COPY custom-providers/*.jar /opt/bitnami/keycloak/providers/
RUN /opt/bitnami/keycloak/bin/kc.sh build

FROM bitnami/keycloak:19.0.2-debian-11-r5
COPY --from=builder /opt/bitnami/keycloak/ /opt/bitnami/keycloak/
WORKDIR /opt/bitnami/keycloak

USER 1001
ENTRYPOINT [ "/opt/bitnami/scripts/keycloak/entrypoint.sh" ]
CMD [ "/opt/bitnami/scripts/keycloak/run.sh" ]

values.yaml


  extraEnvVars: 
    - name: KC_HOSTNAME
      value: "HOSTNAME"
    - name: KC_HOSTNAME_STRICT
      value: "true"
    - name: KEYCLOAK_PROXY_ADDRESS_FORWARDING
      value: "true"
    - name: KC_FEATURES
      value: scripts
    - name: KEYCLOAK_PRODUCTION
      value: "true"
    - name: KC_CACHE_STACK
      value: "kubernetes"
    - name: JAVA_OPTS
      value: "-Djgroups.dns.query=keycloak-headless"
    - name: KC_LOG_LEVEL
      value: debug
    # See https://github.com/bitnami/charts/issues/10923
    - name: KEYCLOAK_EXTRA_ARGS
      value: "--auto-build"
    - name: KC_HEALTH_ENABLED
      value: "true"

  postgresql:
    enabled: false

It works when using the deprecated "--auto-build" command, but when switching to "--optimized" as suggested by the original Keycloak image, it fails to start with the "No suitable driver found ..." message

hendrik-schaffer avatar Sep 30 '22 08:09 hendrik-schaffer

From 19.0.2 :

I got this error with --optimized option :

2022-10-04 08:35:44,885 INFO  [org.keycloak.quarkus.runtime.hostname.DefaultHostnameProvider] (main) Hostname settings: Base URL: <unset>, Hostname: <request>, Strict HTTPS: true, Path: <request>, Strict BackChannel: false, Admin URL: <unset>, Admin: <request>, Port: -1, Proxied: true
2022-10-04 08:35:51,089 INFO  [org.keycloak.common.crypto.CryptoIntegration] (main) Detected crypto provider: org.keycloak.crypto.def.DefaultCryptoProvider
2022-10-04 08:35:54,785 WARN  [io.quarkus.runtime.configuration.ConfigRecorder] (main) Build time property cannot be changed at runtime:
 - quarkus.datasource.jdbc.driver is set to 'org.postgresql.xa.PGXADataSource' but it is build time fixed to 'org.h2.jdbcx.JdbcDataSource'. Did you change the property quarkus.datasource.jdbc.driver after building the application?
2022-10-04 08:35:55,197 WARN  [io.agroal.pool] (agroal-11) Datasource '<default>': No suitable driver found for jdbc:postgresql://postgresql.postgresql.svc.cluster.local:5432/keycloak_dev?currentSchema=public
2022-10-04 08:35:55,279 WARN  [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator] (JPA Startup Thread: keycloak-default) HHH000342: Could not obtain connection to query metadata: java.sql.SQLException: No suitable driver found for jdbc:postgresql://postgresql.postgresql.svc.cluster.local:5432/keycloak_dev?currentSchema=public
        at org.h2.jdbcx.JdbcDataSource.getJdbcConnection(JdbcDataSource.java:191)
        at org.h2.jdbcx.JdbcDataSource.getXAConnection(JdbcDataSource.java:352)
        at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:216)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:513)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:494)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1126)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

However, if I take the --auto-build option, it works

2022-10-04 08:38:55,077 WARN  [org.keycloak.services] (build-32) KC-SERVICES0047: bcrypt (com.github.leroyguillaume.keycloak.bcrypt.BCryptPasswordHashProviderFactory) is implementing the internal SPI password-hashing. This SPI is internal and may change without notice
2022-10-04 08:38:55,089 WARN  [org.keycloak.services] (build-32) KC-SERVICES0047: metrics (org.jboss.aerogear.keycloak.metrics.MetricsEndpointFactory) is implementing the internal SPI realm-restapi-extension. This SPI is internal and may change without notice
2022-10-04 08:38:59,681 WARN  [org.keycloak.services] (build-32) KC-SERVICES0047: metrics-listener (org.jboss.aerogear.keycloak.metrics.MetricsEventListenerFactory) is implementing the internal SPI eventsListener. This SPI is internal and may change without notice
2022-10-04 08:39:27,177 INFO  [io.quarkus.deployment.QuarkusAugmentor] (main) Quarkus augmentation completed in 46688ms
Server configuration updated and persisted. Run the following command to review the configuration:

        kc.sh show-config

Next time you run the server, just run:

        kc.sh start --optimized -cf=/opt/bitnami/keycloak/conf/keycloak.conf

WARNING: The '--auto-build' option for 'start' command is DEPRECATED and no longer needed. When executing the 'start' command, a new server image is automatically built based on the configuration. If you want to disable this behavior and achieve an optimal startup time, use the '--optimized' option instead.

qdupuy avatar Oct 04 '22 08:10 qdupuy

Could you try the following ?

$ helm install mypostgres bitnami/postgresql --set auth.postgresPassword=test1 --set auth.database=bitnami_keycloak
NAME: mypostgres
LAST DEPLOYED: Tue Oct 18 12:44:57 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: postgresql
CHART VERSION: 11.9.8
APP VERSION: 14.5.0

...

$ git clone https://github.com/bitnami/charts.git
$ cd charts/bitnami/keycloak

$ helm install mykey -f values.yaml .
NAME: mykey
LAST DEPLOYED: Tue Oct 18 13:00:05 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: keycloak
CHART VERSION: 10.1.5
APP VERSION: 19.0.3
...

The changes in values.yaml are:

--- a/bitnami/keycloak/values.yaml
+++ b/bitnami/keycloak/values.yaml
@@ -136,10 +136,10 @@ auth:
   tls:
     ## @param auth.tls.enabled Enable TLS encryption. Required for HTTPs traffic.
     ##
-    enabled: false
+    enabled: true
     ## @param auth.tls.autoGenerated Generate automatically self-signed TLS certificates. Currently only supports PEM certificates
     ##
-    autoGenerated: false
+    autoGenerated: true
     ## @param auth.tls.existingSecret Existing secret containing the TLS certificates per Keycloak replica
     ## Create this secret following the steps below:
     ## 1) Generate your truststore and keystore files (more info at https://www.keycloak.org/docs/latest/server_installation/#_setting_up_ssl)
@@ -153,7 +153,7 @@ auth:
     ## If "true", the Keycloak chart will look for the files ca.crt, keycloak-X.key and keycloak-X.crt inside the secret provided with 'existingSecret'.
     ## If keystorePassword and truststorePassword are not provided, they will be autogenerated.
     ##
-    usePem: false
+    usePem: true
     ## @param auth.tls.truststoreFilename Truststore specific filename inside the existing secret
     ## Note: Setting up this value, you will use the same truststore file in all the replicas
     ##
@@ -248,6 +248,28 @@ args: []
 ##     value: "bar"
 ##
-extraEnvVars: []
+extraEnvVars:
+     - name: KC_HOSTNAME
+       value: "myhostname"
+     - name: KC_HOSTNAME_STRICT
+       value: "true"
+     - name: KEYCLOAK_PROXY_ADDRESS_FORWARDING
+       value: "true"
+     - name: KC_FEATURES
+       value: scripts
+     - name: KEYCLOAK_PRODUCTION
+       value: "true"
+     - name: KC_CACHE_STACK
+       value: "kubernetes"
+     - name: JAVA_OPTS
+       value: "-Djgroups.dns.query=keycloak-headless"
+     - name: KC_LOG_LEVEL
+       value: debug
+     # See https://github.com/bitnami/charts/issues/10923
+     #    - name: KEYCLOAK_EXTRA_ARGS
+     #      value: "--auto-build"
+     - name: KC_HEALTH_ENABLED
+       value: "true"
+
 ## @param extraEnvVarsCM Name of existing ConfigMap containing extra env vars
 ##
 extraEnvVarsCM: ""
@@ -974,7 +996,7 @@ keycloakConfigCli:
 ## @param postgresql.architecture PostgreSQL architecture (`standalone` or `replication`)
 ##
 postgresql:
-  enabled: true
+  enabled: false
   auth:
     username: bn_keycloak
     password: ""
@@ -992,11 +1014,11 @@ postgresql:
 ## @param externalDatabase.existingSecretPasswordKey Name of an existing secret key containing the database credentials
 ##
 externalDatabase:
-  host: ""
+  host: "mypostgres-postgresql"
   port: 5432
-  user: bn_keycloak
+  user: postgres
   database: bitnami_keycloak
-  password: ""
+  password: "test1"
   existingSecret: ""
   existingSecretPasswordKey: ""

I am using the default image for the chart, in this case:

75-  registry: docker.io
76-  repository: bitnami/keycloak
77:  tag: 19.0.3-debian-11-r2

854-    registry: docker.io
855-    repository: bitnami/keycloak-config-cli
856:    tag: 5.3.1-debian-11-r23

rafariossaa avatar Oct 18 '22 11:10 rafariossaa