{"record":{"id":"286d18115f79cb84","repo":"apache/seatunnel","slug":"either-metastore-uri-or-hive-metastore-client-fact","errorCode":null,"errorMessage":"Either metastore_uri or hive.metastore.client.factory.class must be configured","messagePattern":"Either metastore_uri or hive\\.metastore\\.client\\.factory\\.class must be configured","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveMetaStoreCatalog.java","lineNumber":159,"sourceCode":"            }\n            return createClient(hiveConf);\n        } catch (Exception e) {\n            String errMsg =\n                    String.format(\n                            \"Failed to initialize HiveMetaStoreClient [uris=%s, hiveSite=%s]\",\n                            metastoreUri, hiveSitePath);\n            throw new HiveConnectorException(\n                    HiveConnectorErrorCode.INITIALIZE_HIVE_METASTORE_CLIENT_FAILED, errMsg, e);\n        }\n    }\n\n    private IMetaStoreClient createClient(HiveConf hiveConf) throws Exception {\n        String clientFactoryClassName = hiveConf.getTrimmed(METASTORE_CLIENT_FACTORY_CLASS);\n        if (StringUtils.isNotBlank(clientFactoryClassName)) {\n            return createClientFromFactory(hiveConf, clientFactoryClassName);\n        }\n        if (StringUtils.isBlank(hiveConf.getTrimmed(\"hive.metastore.uris\"))) {\n            throw new IllegalArgumentException(\n                    \"Either metastore_uri or hive.metastore.client.factory.class must be configured\");\n        }\n        IMetaStoreClient retryingClient = tryCreateRetryingClient(hiveConf);\n        if (retryingClient != null) {\n            return retryingClient;\n        }\n        return new HiveMetaStoreClient(hiveConf);\n    }\n\n    /**\n     * Creates a metastore client through the Hive 3 factory contract used by AWS Glue Data Catalog.\n     */\n    private IMetaStoreClient createClientFromFactory(\n            HiveConf hiveConf, String clientFactoryClassName) {\n        try {\n            Class<?> factoryClass = loadClass(clientFactoryClassName, hiveConf);\n            Object factory = factoryClass.getDeclaredConstructor().newInstance();\n            Method createClientMethod =","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveMetaStoreCatalog.java#L141-L177","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nHiveMetaStoreCatalog catalog = new HiveMetaStoreCatalog(new ReadonlyConfig(emptyMap));\n// after\nMap<String,Object> c = new HashMap<>();\nc.put(\"metastore_uri\", \"thrift://metastore:9083\");\nHiveMetaStoreCatalog catalog = new HiveMetaStoreCatalog(new ReadonlyConfig(c));","handlingStrategy":"validation","validationCode":"boolean hasFactory = hiveConf.getTrimmed(\"hive.metastore.client.factory.class\") != null;\nboolean hasUris = hiveConf.getTrimmed(\"hive.metastore.uris\") != null;\nif (!hasFactory && !hasUris) {\n    throw new IllegalArgumentException(\"Set metastore_uri option or hive.metastore.uris in hive-site.xml\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    catalog.getClient();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"Either metastore_uri\")) {\n        throw new IllegalStateException(\"Provide metastore_uri in connector config\", e);\n    }\n    throw e;\n}","preventionTips":["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"],"tags":["hive-metastore","config","missing-uri"],"backgroundTag":"missing-required-config-field","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}