Java buildpack auto downloading unneeded MariaDB JDBC driver for app binding to database service provisioned by CSB for AWS
search cancel

Java buildpack auto downloading unneeded MariaDB JDBC driver for app binding to database service provisioned by CSB for AWS

book

Article ID: 297186

calendar_today

Updated On:

Products

Support Only for Spring

Issue/Introduction

When users push an application binding to a MySQL database service which is provisioned by Tanzu Cloud Service Broker for AWS, they might want to use vendor (AWS) provided database driver archive (e.g. aws-mysql-jdbc.jar) instead of the MariaDB JDBC driver which will be prepared by Java buildpack. However Java buildpack would still automatically download the MariaDB JDBC driver when staging the application, as shown below, which is not expected by the users.
Staging app and tracing logs...
   Downloading java_buildpack_offline...
   Downloaded java_buildpack_offline
   Cell dfcc22b2-d846-4d6b-a972-2368d2ed1601 creating container for instance 422a7e8b-00a7-4bcd-8a0d-f7e1488817e7
   Security group rules were updated
   Cell dfcc22b2-d846-4d6b-a972-2368d2ed1601 successfully created container for instance 422a7e8b-00a7-4bcd-8a0d-f7e1488817e7
   Downloading app package...
   Downloading build artifacts cache...
   Downloaded build artifacts cache (130B)
   Downloaded app package (65.6M)
   -----> Java Buildpack v4.67.0 (offline) | https://github.com/cloudfoundry/java-buildpack#1ca7a11b
   -----> Downloading Jvmkill Agent 1.17.0_RELEASE from https://java-buildpack.cloudfoundry.org/jvmkill/jammy/x86_64/jvmkill-1.17.0-RELEASE.so (found in cache)
   -----> Downloading Open Jdk JRE 17.0.10_13 from https://java-buildpack.cloudfoundry.org/openjdk/jammy/x86_64/bellsoft-jre17.0.10%2B13-linux-amd64.tar.gz (found in cache)
   Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.2s)
   JVM DNS caching disabled in lieu of BOSH DNS caching
   -----> Downloading Open JDK Like Memory Calculator 3.13.0_RELEASE from https://java-buildpack.cloudfoundry.org/memory-calculator/jammy/x86_64/memory-calculator-3.13.0-RELEASE.tar.gz (found in cache)
   Loaded Classes: 29396, Threads: 250
   -----> Downloading Client Certificate Mapper 2.0.1 from https://java-buildpack.cloudfoundry.org/client-certificate-mapper/client-certificate-mapper-2.0.1.jar (found in cache)
   -----> Downloading Container Security Provider 1.20.0_RELEASE from https://java-buildpack.cloudfoundry.org/container-security-provider/container-security-provider-1.20.0-RELEASE.jar (found in cache)
   -----> Downloading Maria Db JDBC 2.7.9 from https://java-buildpack.cloudfoundry.org/mariadb-jdbc/mariadb-jdbc-2.7.9.jar (found in cache)
......


Environment

Product Version: 3.1

Resolution

The MariaDB JDBC driver is downloaded by Java buildpack according to the detection criterion described in buildpack documentation according to VCAP_SERVICES palyload for the app binding to database service provisioned by CSB for AWS. For example,
$ cf env app1

Getting env variables for app test in org unify / space test as admin...
System-Provided:
VCAP_SERVICES: {
 "csb-aws-mysql": [
   {
     "binding_guid": "e84d3755-4d1a-470d-9526-cf9673949cc9",
     "binding_name": null,
     "credentials": {
       "credhub-ref": "/c/csb/csb-aws-mysql/e84d3755-4d1a-470d-9526-cf9673949cc9/secrets-and-services"
     },
     "instance_guid": "1ee98d8d-90fb-4524-b5f6-96340344becd",
     "instance_name": "unify-dashboard-data-csbunify-it3",
     "label": "csb-aws-mysql",
     "name": "unify-dashboard-data-csbunify-it3",
     "plan": "unifymicro-rds-mysql",
     "provider": null,
     "syslog_drain_url": null,
     "tags": [
       "aws",
       "mysql"
     ],
     "volume_mounts": []
   }
 ],
......
Although the app already includes its own JDBC driver called aws-mysql-jdbc.jar, but the driver archive name doesn't match exception list as shown here. That's why MariaDB JDBC driver is still downloaded by Java buildpack.

A Github issue has been created to request adding driver file aws-mysql-jdbc.jar to the exception list. Before the Github issue is fixed in a new Java buildpack release, user can try to avoid auto downloading MariaDB JDBC driver by renaming self-provided JDBC driver to something like mysql-connector-j*.jar.