apache/seatunnel · error · IllegalArgumentException
Either metastore_uri or hive.metastore.client.factory.class…
Error message
Either metastore_uri or hive.metastore.client.factory.class must be configured
What it means
createClient requires either a configured metastore client factory class or thrift URIs (hive.metastore.uris). If neither hive.metastore.client.factory.class nor hive.metastore.uris is set in the HiveConf, it throws this IllegalArgumentException because there is no way to construct a metastore client.
Solutions
- Set metastore_uri in the connector config, e.g. thrift://host:9083.
- Or add <property><name>hive.metastore.uris</name><value>thrift://host:9083</value></property> to hive-site.xml and ensure it is loaded.
- Or configure hive.metastore.client.factory.class if using a custom client factory.
- Log/inspect the resolved HiveConf to confirm which keys are actually present.
Example fix
// before
HiveMetaStoreCatalog catalog = new HiveMetaStoreCatalog(new ReadonlyConfig(emptyMap));
// after
Map<String,Object> c = new HashMap<>();
c.put("metastore_uri", "thrift://metastore:9083");
HiveMetaStoreCatalog catalog = new HiveMetaStoreCatalog(new ReadonlyConfig(c)); Defensive patterns
Strategy: validation
Validate before calling
boolean hasFactory = hiveConf.getTrimmed("hive.metastore.client.factory.class") != null;
boolean hasUris = hiveConf.getTrimmed("hive.metastore.uris") != null;
if (!hasFactory && !hasUris) {
throw new IllegalArgumentException("Set metastore_uri option or hive.metastore.uris in hive-site.xml");
} Try / catch
try {
catalog.getClient();
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("Either metastore_uri")) {
throw new IllegalStateException("Provide metastore_uri in connector config", e);
}
throw e;
} Prevention
- Always pass metastore_uri explicitly in connector config
- Ensure hive-site.xml loaded by HiveConf contains hive.metastore.uris
- Log resolved HiveConf keys during troubleshooting
When it happens
Trigger: Calling createClient (from initializeClient, loginWithKerberos, or loginWithRemoteUser) when the resolved HiveConf lacks both 'hive.metastore.client.factory.class' and 'hive.metastore.uris' — i.e. metastore_uri option was not provided and no hive-site supplies the URIs.
Common situations: User omits metastore_uri hoping hive-site.xml on the classpath provides it, but hive-site.xml is absent or was stripped of the uris property; local HiveConf built without either key.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- accessId and accesskey must be provided when sts_token is…
- Agent config is not a readable file
- agent.id must be non-empty after resolution.
- At least one sink plugin must be configured.
- At least one source plugin must be configured.
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/286d18115f79cb84.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveMetaStoreCatalog.java:159
}
return createClient(hiveConf);
} catch (Exception e) {
String errMsg =
String.format(
"Failed to initialize HiveMetaStoreClient [uris=%s, hiveSite=%s]",
metastoreUri, hiveSitePath);
throw new HiveConnectorException(
HiveConnectorErrorCode.INITIALIZE_HIVE_METASTORE_CLIENT_FAILED, errMsg, e);
}
}
private IMetaStoreClient createClient(HiveConf hiveConf) throws Exception {
String clientFactoryClassName = hiveConf.getTrimmed(METASTORE_CLIENT_FACTORY_CLASS);
if (StringUtils.isNotBlank(clientFactoryClassName)) {
return createClientFromFactory(hiveConf, clientFactoryClassName);
}
if (StringUtils.isBlank(hiveConf.getTrimmed("hive.metastore.uris"))) {
throw new IllegalArgumentException(
"Either metastore_uri or hive.metastore.client.factory.class must be configured");
}
IMetaStoreClient retryingClient = tryCreateRetryingClient(hiveConf);
if (retryingClient != null) {
return retryingClient;
}
return new HiveMetaStoreClient(hiveConf);
}
/**
* Creates a metastore client through the Hive 3 factory contract used by AWS Glue Data Catalog.
*/
private IMetaStoreClient createClientFromFactory(
HiveConf hiveConf, String clientFactoryClassName) {
try {
Class<?> factoryClass = loadClass(clientFactoryClassName, hiveConf);
Object factory = factoryClass.getDeclaredConstructor().newInstance();
Method createClientMethod =View on GitHub (pinned to cf67b549a7)