bitnami / containers

Bitnami container images
https://bitnami.com
Other
3.25k stars 4.75k forks source link

[bitnami/ejbca] Container does not start - wrong driver class [org.mariadb.jdbc.Driver] #71088

Closed pandel closed 2 weeks ago

pandel commented 3 weeks ago

Name and Version

bitnami/ejbca:8

What architecture are you using?

amd64

What steps will reproduce the bug?

Hi!

I updated the bitnami\ejbca:8 and bitnami\mariadb:10.11 images to the latest version (of today, 21.08.2024) and restarted the docker compose stack. But now, the ejbca container won't start. It does not deploy the ejbca.ear and if I look into the wildfly log, I get the following:

2024-08-21 10:15:35,309 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "ejbca.ear")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.persistenceunit.\"ejbca.ear#ejbca\"" => "javax.persistence.PersistenceException: [PersistenceUnit: ejbca] Unable to build Hibernate SessionFactory
    Caused by: javax.persistence.PersistenceException: [PersistenceUnit: ejbca] Unable to build Hibernate SessionFactory
    Caused by: org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution
    Caused by: java.sql.SQLException: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/EjbcaDS
    Caused by: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/EjbcaDS
    Caused by: javax.resource.ResourceException: IJ031084: Unable to create connection
    Caused by: javax.resource.ResourceException: IJ031083: Wrong driver class [org.mariadb.jdbc.Driver] for this connection URL [jdbc:mysql://mariadb:3306/ejbca]"}}
2024-08-21 10:15:35,370 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) WFLYSRV0010: Deployed "ejbca.ear" (runtime-name : "ejbca.ear")
2024-08-21 10:15:35,375 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) WFLYCTL0183: Service status report
WFLYCTL0186:   Services which failed to start:      service jboss.persistenceunit."ejbca.ear#ejbca": javax.persistence.PersistenceException: [PersistenceUnit: ejbca] Unable to build Hibernate SessionFactory
WFLYCTL0448: 615 additional services are down due to their dependencies being missing or failed

The corresponding section in the standalone.xml is as follows:

       <subsystem xmlns="urn:jboss:domain:datasources:7.0">
            <datasources>
                <datasource jndi-name="java:/EjbcaDS" pool-name="ejbcads" use-ccm="true">
                    <connection-url>jdbc:mysql://mariadb:3306/ejbca</connection-url>
                    <driver-class>org.mariadb.jdbc.Driver</driver-class>
                    <driver>mariadb-java-client-3.4.1.jar</driver>
                    <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
                    <pool>
                        <min-pool-size>5</min-pool-size>
                        <max-pool-size>150</max-pool-size>
                        <prefill>true</prefill>
                    </pool>
                    <security>
                        <user-name>REDACTED</user-name>
                        <password>REDACTED</password>
                    </security>
                    <validation>
                        <check-valid-connection-sql>select 1;</check-valid-connection-sql>
                        <validate-on-match>true</validate-on-match>
                        <background-validation>false</background-validation>
                    </validation>
                    <statement>
                        <prepared-statement-cache-size>50</prepared-statement-cache-size>
                        <share-prepared-statements>true</share-prepared-statements>
                    </statement>
                </datasource>
                <drivers>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                    </driver>
                </drivers>
            </datasources>
        </subsystem>

The deployed driver file is mariadb-java-client-3.4.1.jar. It does not matter if I set EJBCA_DATABASE_FLAVOR to mariadb or mysql.

I did not change anything in my .env or docker-compose.yml.

What can I do?

Regards, Holger

What is the expected behavior?

Container EJBCA starts successfully.

What do you see instead?

Container hangs at

ejbca | ejbca 10:27:11.30 INFO ==> Deploying EJBCA application

Additional information

No response

javsalgar commented 3 weeks ago

Hi!

From which version are you upgrading?

pandel commented 3 weeks ago

I upgraded a few weeks ago the last time, but sadly, I don't know the exact version numbers. But it was already ejbca:8 and mariadb:10.3 images. Sorry that I can't be more specific...

But as I did not have any problems over the whole time using and upgrading the images, I did not think about it this time, too. Maybe I should have...

javsalgar commented 2 weeks ago

Could you try rolling back to previous images to see where the problem would be?

pandel commented 2 weeks ago

I am not in the office right now for a while, but I'll try to and report.

pandel commented 2 weeks ago

So, I retried to downgrade the ejbca image to 8.2.0-1. That worked so far, but the error message is still

Caused by: javax.resource.ResourceException: IJ031083: Wrong driver class [org.mariadb.jdbc.Driver] for this connection URL [jdbc:mysql://mariadb:3306/ejbca]

The ejbca container simply isn't able to connect to the mariadb container, even though a simply mysql -hmaridb -uroot -pXXXXX command does the trick. It seems as if the connectiong string is broken somehow with the 10.11 version of mariadb.

EDIT: GOT IT!!! (Downgraded to images ejbca:8.2.0-1 and mariadb:10.6 before)

It was this line

jdbc:mysql://mariadb:3306/ejbca

which had to be changed to this line

jdbc:mariadb://mariadb:3306/ejbca

The mariadb jdbc client 3.4.0 seems to need this exactly. I absolutely don't understand why this happened now and not a lot earlier, but I am glad it worked.