apache/seatunnel · critical · CatalogException

Failed to open Hive catalog

Error message

Failed to open Hive catalog

What it means

CatalogException thrown by the Catalog open() lifecycle method when the initial getClient() call fails with a HiveConnectorException. It means the Hive metastore client could not be constructed at catalog startup, so the entire catalog is unusable and the job aborts early.

Source

Thrown at seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveMetaStoreCatalog.java:564

            getClient().dropTable(dbName, tableName, true, true);
        } catch (TException e) {
            String msg = String.format("Failed to drop table %s.%s", dbName, tableName);
            throw new HiveConnectorException(
                    HiveConnectorErrorCode.CREATE_HIVE_TABLE_FAILED, msg, e);
        }
    }

    public void createTableFromTemplate(@NonNull Table table) throws TException {
        log.info("Create table from template {}.{}", table.getDbName(), table.getTableName());
        createTableIfNotExists(table);
    }

    @Override
    public void open() throws CatalogException {
        try {
            getClient();
        } catch (HiveConnectorException e) {
            throw new CatalogException("Failed to open Hive catalog", e);
        }
    }

    @Override
    public String name() {
        return "hive";
    }

    @Override
    public String getDefaultDatabase() throws CatalogException {
        return "default";
    }

    @Override
    public List<String> listDatabases() throws CatalogException {
        try {
            return getClient().getAllDatabases();
        } catch (TException e) {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check the chained HiveConnectorException cause for the root failure (factory load vs connection).
  2. Verify the catalog config: metastore uris, hive version, and credentials.
  3. Ensure the Hive connector plugin and its Hive dependencies are installed on all nodes.
  4. Test metastore connectivity from the machine (nc/telnet on the thrift port) before resubmitting.

Example fix

// before
HiveCatalog catalog = new HiveCatalog("hive", ...); // metastore uri typo
// after: fix config so open() succeeds
catalogProps.put("metastore.uris", "thrift://metastore-host:9083");
catalog.open();
Defensive patterns

Strategy: validation

Validate before calling

// verify metastore reachability before opening the catalog
Socket s = new Socket();
s.connect(new InetSocketAddress("metastore-host", 9083), 3000);
s.close();

Try / catch

try {
    catalog.open();
} catch (CatalogException e) {
    throw new IllegalStateException("Hive catalog init failed: " + e.getCause(), e);
}

Prevention

When it happens

Trigger: Calling open() during catalog initialization when the metastore URI is invalid/unreachable, credentials fail, or client factory construction fails (see the 'Unable to load Hive metastore client factory' error).

Common situations: Wrong metastore uris in catalog config; metastore service down at job submission; missing Hive jars/plugin dependencies on the classpath; Kerberos principal/keytab misconfigured.

Understand the failure class

Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/fc864d29733230a9. Report an issue: GitHub.