Skip to content

Commit

Permalink
fix: classloader issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jierwang committed Feb 7, 2024
1 parent eb1f7c8 commit 3e85ab3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ public String getHiveVersion() {
@Override
public void open() throws CatalogException {
if (client == null) {
this.hiveConf.setClassLoader(Thread.currentThread().getContextClassLoader());
client = HiveMetastoreClientFactory.create(hiveConf, hiveVersion);
LOG.info("Connected to Hive metastore");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.apache.flink.table.factories.FactoryUtil;
import org.apache.flink.util.Preconditions;
import org.apache.flink.util.StringUtils;
import org.apache.flink.util.TemporaryClassLoaderContext;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -310,7 +311,10 @@ public void createCatalog(String catalogName, CatalogDescriptor catalogDescripto
}

Catalog catalog = initCatalog(catalogName, catalogDescriptor);
catalog.open();
try (TemporaryClassLoaderContext context =
TemporaryClassLoaderContext.of(catalogStoreHolder.classLoader())) {
catalog.open();
}
catalogs.put(catalogName, catalog);

catalogStoreHolder.catalogStore().storeCatalog(catalogName, catalogDescriptor);
Expand Down

0 comments on commit 3e85ab3

Please sign in to comment.