Keycloak 17 (Quarkus): no suitable driver found for jdbc:postgresql
See original GitHub issueDescribe the bug
We are running Keycloak in AWS ECS for some time now and are planning to upgrade to Keycloak 17 (Quarkus). But the container won’t start with this error message:
ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: No suitable driver found for jdbc:postgresql://ecs-keycloak.xxxxxxxxxx.eu-west-1.rds.amazonaws.com/keycloak
The environment vars for the ECS task are as follows:
"environment" : [
{ "name" : "KEYCLOAK_ADMIN", "value" : "${keycloak_username}" },
{ "name" : "KEYCLOAK_ADMIN_PASSWORD", "value" : "${keycloak_password}" },
{ "name" : "KC_PROXY", "value" : "edge" },
{ "name" : "KC_DB", "value" : "postgres" },
{ "name" : "KC_DB_URL_HOST", "value" : "${database_hostname}" },
{ "name" : "KC_DB_URL_DATABASE", "value" : "keycloak" },
{ "name" : "KC_DB_USERNAME", "value" : "${keycloak_rds_username}" },
{ "name" : "KC_DB_PASSWORD", "value" : "${keycloak_rds_password}" },
{ "name" : "KC_METRICS_ENABLED", "value" : "true" },
{ "name" : "KC_FEATURES", "value" : "preview" },
{ "name" : "KC_HTTP_RELATIVE_PATH", "value" : "/auth" },
{ "name" : "KC_HOSTNAME_STRICT", "value" : "false" },
{ "name" : "KC_CACHE_CONFIG_FILE", "value" : "cache-ispn-jdbc-ping.xml" }
],
The cache-file being used is this one.
Am i missing something? I’ve started the container locally (with start-dev
) to check if the postgresql driver is present, but it is present in the container:
bash-4.4$ ls -l /opt/keycloak/lib/lib/main/ | grep postgres
-rw-rw-r-- 1 keycloak root 12059 Feb 11 19:15 io.quarkus.quarkus-devservices-postgresql-2.7.0.Final.jar
-rw-rw-r-- 1 keycloak root 17074 Feb 11 19:15 io.quarkus.quarkus-jdbc-postgresql-2.7.0.Final.jar
-rw-rw-r-- 1 keycloak root 6220 Feb 11 19:15 io.quarkus.quarkus-jdbc-postgresql-deployment-2.7.0.Final.jar
-rw-rw-r-- 1 keycloak root 1015689 Feb 11 19:15 org.postgresql.postgresql-42.3.1.jar
-rw-rw-r-- 1 keycloak root 9725 Feb 11 19:15 org.testcontainers.postgresql-1.16.3.jar
So i’m lost as to what is causing this. Is it because it is an AWS RDS running PostgreSQL 11?
Version
17.0.0
Expected behavior
Working Postgresql driver (even with AWS RDS Postgresql)
Actual behavior
ERROR: No suitable driver found for jdbc:postgresql://ecs-keycloak.xxxxxxxxxx.eu-west-1.rds.amazonaws.com/keycloak
How to Reproduce?
Try running it in AWS ECS. This is our docker file:
FROM quay.io/keycloak/keycloak:17.0.0 as builder
ENV KC_CACHE_CONFIG_FILE=cache-ispn-jdbc-ping.xml
COPY ./cache-ispn-jdbc-ping.xml /opt/keycloak/conf/cache-ispn-jdbc-ping.xml
RUN /opt/keycloak/bin/kc.sh build
FROM quay.io/keycloak/keycloak:17.0.0
COPY --from=builder /opt/keycloak/lib/quarkus/ /opt/keycloak/lib/quarkus/
# Install Metrics plugin
COPY keycloak-metrics-spi-2.5.3.jar /opt/keycloak/providers/
# Install PrivacyIDEA plugin
COPY PrivacyIDEA-Provider.jar /opt/keycloak/providers/
# Install Themes
COPY themes/ /opt/keycloak/themes/
# Install SSO CA AD cert
COPY files/ca.crt /tmp/ca.crt
USER root
RUN keytool -import -trustcacerts -alias local-CA -file /tmp/ca.crt -keystore /usr/lib/jvm/jre/lib/security/cacerts -storepass changeit -noprompt
USER 1000
EXPOSE 7600
ENTRYPOINT ["/opt/keycloak/bin/kc.sh", "start"]
Anything else?
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
Keycloak 17.0.0 docker image can't find ... - Stack Overflow
So it should be build parameter --db=postgres . BTW: I would use quay.io/keycloak/keycloak:17.0.0 image (17.0.0 is first stable Quarkus based ...
Read more >Keycloak X preview with PostgreSQL Database
Hello, I try to deploy the new Keycloak X preview version with a ... No suitable driver found for jdbc:postgresql://localhost:5432/keycloak.
Read more >Keycloak-x database driver missing - Google Groups
I am testing out the 16.1.1 preview release of Keycloak-x. ... '<default>': No suitable driver found for jdbc:postgresql://localhost:5432/keycloak
Read more >Keycloak 17.0.0 docker image can't find suitable driver for ...
So it should be build parameter --db=postgres . BTW: I would use quay.io/keycloak/keycloak:17.0.0 image (17.0.0 is first stable Quarkus based Keycloak ...
Read more >Keycloak and postgres integration issue in kubernetes
Hi, When installing keycloak with postgres getting below error. ... (main) ERROR: No suitable driver found for jdbc:postgresql://kc.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, you have to build your own docker image to make the postgres jdbc driver available. A minimal dockerfile should look like this:
This worked for me.
Adding the ENV parameter for the DB type before the build fixed it for me also! Tnx for the help.