{"record":{"id":"9f83a1ec8b3a4a4a","repo":"apache/seatunnel","slug":"hive-metastore-client-factory-clientfactoryclass-9f83a1","errorCode":null,"errorMessage":"Hive metastore client factory ${clientFactoryClassName} failed to create a client","messagePattern":"Hive metastore client factory (.+?) failed to create a client","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveMetaStoreCatalog.java","lineNumber":201,"sourceCode":"                            ConcurrentHashMap.class);\n            HiveMetaHookLoader hookLoader = tableName -> null;\n            Object client =\n                    createClientMethod.invoke(\n                            factory,\n                            hiveConf,\n                            hookLoader,\n                            false,\n                            new ConcurrentHashMap<String, Long>());\n            if (!(client instanceof IMetaStoreClient)) {\n                throw new IllegalStateException(\n                        String.format(\n                                \"Hive metastore client factory %s returned an incompatible client\",\n                                clientFactoryClassName));\n            }\n            log.info(\"Using Hive metastore client factory {}\", clientFactoryClassName);\n            return (IMetaStoreClient) client;\n        } catch (InvocationTargetException e) {\n            throw new IllegalStateException(\n                    String.format(\n                            \"Hive metastore client factory %s failed to create a client\",\n                            clientFactoryClassName),\n                    e.getCause());\n        } catch (ReflectiveOperationException | LinkageError e) {\n            throw new IllegalStateException(\n                    String.format(\n                            \"Unable to load Hive metastore client factory %s. Make sure the factory and compatible Hive classes are available on the runtime classpath\",\n                            clientFactoryClassName),\n                    e);\n        }\n    }\n\n    /**\n     * Resolves an optional metastore factory from the runtime context before falling back to Hive's\n     * configured class loader.\n     */\n    private static Class<?> loadClass(String className, HiveConf hiveConf)","sourceCodeStart":183,"sourceCodeEnd":219,"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#L183-L219","documentation":"createClientFromFactory invokes the configured client factory reflectively. If the factory method itself throws (InvocationTargetException), a reflective failure occurs (ReflectiveOperationException), or the factory class cannot be loaded (LinkageError), it wraps the problem in an IllegalStateException stating the factory failed to create a client — with the underlying cause (e.getCause() for invocation failures) attached.","triggerScenarios":"Calling createClient when the configured factory class does not exist, cannot be loaded (missing jar/conflicting Hive versions), its constructor/method throws at runtime, or it fails wiring dependencies (hook loader, conf).","commonSituations":"Factory class typo in config, hive-exec/standalone-metastore jars missing from the plugin dir, NoSuchMethodError from mixed Hive versions, or factory throwing during initialization (e.g. bad conf).","solutions":["Read the chained cause (getCause) for the real failure: ClassNotFoundException vs NoSuchMethodError vs factory runtime error.","Fix the fully-qualified factory class name in the config.","Ensure the correct Hive client jars are in the SeaTunnel plugin/connectors directory (no mixed Hive versions).","Fall back to the standard path: unset the factory class and set metastore_uri instead."],"exampleFix":"// before\nhive.metastore.client.factory.class = org.apache.hive.metastore.NonExistentFactory\n// after (use URI-based client)\nmetastore_uri = \"thrift://metastore:9083\"","handlingStrategy":"try-catch","validationCode":"String cls = hiveConf.getTrimmed(\"hive.metastore.client.factory.class\");\nif (cls != null) {\n    try { Class.forName(cls, false, Thread.currentThread().getContextClassLoader()); }\n    catch (Throwable t) { throw new IllegalArgumentException(\"factory class not on classpath: \" + cls); }\n}","typeGuard":null,"tryCatchPattern":"try {\n    catalog.getClient();\n} catch (IllegalStateException e) {\n    LOG.error(\"Factory failed to create client; root cause:\", e.getCause());\n    throw new IllegalStateException(\"Fix factory class/jars or use metastore_uri instead\", e);\n}","preventionTips":["Verify the exact fully-qualified factory class name against your Hive version","Ensure Hive client jars are present and not version-mixed in the plugin directory","Read e.getCause() (NoSuchMethodError/ClassNotFoundException) to pinpoint jar conflicts"],"tags":["hive-metastore","reflection","class-not-found"],"backgroundTag":"class-not-found","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}