From 66879d0c4c73b9cd371cdffec3a56f25c340a100 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Fri, 1 Feb 2019 15:45:52 -0500 Subject: Hack to force classloader t find mariadb driver Container is not coming up because dblib is getting ClassNotFoundException for mariadb driver, even though it is installed. To correct this temporarily, updated code to explicitly create a driver object. Change-Id: I210d042be2c71a4392781ad26f858c916dbd7364 Issue-ID: CCSDK-489 Signed-off-by: Timoney, Dan (dt5972) --- .../main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'dblib') diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java index 9d797d09..0b8c565f 100755 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java @@ -24,6 +24,7 @@ package org.onap.ccsdk.sli.core.dblib; import java.io.PrintWriter; import java.sql.Connection; +import java.sql.Driver; import java.sql.SQLDataException; import java.sql.SQLException; import java.sql.SQLFeatureNotSupportedException; @@ -92,6 +93,12 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb public DBResourceManager(final Properties properties) { this.configProps = properties; + + // TODO : hack to force classloader to cache mariadb driver. This shouldnt be necessary, + // but for some reason it is (without this, dblib throws ClassNotFound on mariadb driver + // and fails to load). + Driver dvr = new org.mariadb.jdbc.Driver(); + dvr = null; // get retry interval value retryInterval = getLongFromProperties(properties, "org.onap.dblib.connection.retry", 10000L); -- cgit 1.2.3-korg