diff --git a/core/src/main/java/org/apache/gravitino/connector/BaseCatalog.java b/core/src/main/java/org/apache/gravitino/connector/BaseCatalog.java index 14b1912b4d6..444e89062a6 100644 --- a/core/src/main/java/org/apache/gravitino/connector/BaseCatalog.java +++ b/core/src/main/java/org/apache/gravitino/connector/BaseCatalog.java @@ -208,8 +208,15 @@ public void initAuthorizationPluginInstance(IsolatedClassLoader classLoader) { try { BaseAuthorization authorization = BaseAuthorization.createAuthorization(classLoader, authorizationProvider); + + // Load the authorization plugin with the class loader of the catalog. + // Because the JDBC authorization plugin may load JDBC driver using the class loader. authorizationPlugin = - authorization.newPlugin(entity.namespace().level(0), provider(), this.conf); + classLoader.withClassLoader( + cl -> + authorization.newPlugin( + entity.namespace().level(0), provider(), this.conf)); + } catch (Exception e) { LOG.error("Failed to load authorization with class loader", e); throw new RuntimeException(e);