{"record":{"id":"b748d60fe79d217e","repo":"apache/druid","slug":"failed-to-initialize-glue-catalog","errorCode":null,"errorMessage":"Failed to initialize Glue catalog","messagePattern":"Failed to initialize Glue catalog","errorType":"exception","errorClass":"RE (org.apache.druid.java.util.common.RE)","httpStatus":null,"severity":"critical","filePath":"extensions-contrib/druid-iceberg-extensions/src/main/java/org/apache/druid/iceberg/input/GlueIcebergCatalog.java","lineNumber":109,"sourceCode":"    log.info(\"Glue catalog set [%s].\", catalog.toString());\n    return catalog;\n  }\n\n  private Catalog setupGlueCatalog()\n  {\n    // We are not passing any hadoop config, third parameter is null\n    catalogProperties.put(\"type\", TYPE_KEY);\n\n    // AWS Glue catalog internally uses reflection to locate certain classes from the iceberg-aws dependency.\n    // These classes are not available in the current context class loader, and so we explicitly set the context class loader to the system classloader.\n    ClassLoader currCtxClassloader = Thread.currentThread().getContextClassLoader();\n    try {\n      Thread.currentThread().setContextClassLoader(getClass().getClassLoader());\n      catalog = new GlueCatalog();\n      catalog.initialize(CATALOG_NAME, catalogProperties);\n    }\n    catch (Exception e) {\n      throw new RE(e, \"Failed to initialize Glue catalog\");\n    }\n    finally {\n      Thread.currentThread().setContextClassLoader(currCtxClassloader);\n    }\n    return catalog;\n  }\n\n  @Override\n  public boolean isCaseSensitive()\n  {\n    return caseSensitive;\n  }\n}\n","sourceCodeStart":91,"sourceCodeEnd":123,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-contrib/druid-iceberg-extensions/src/main/java/org/apache/druid/iceberg/input/GlueIcebergCatalog.java#L91-L123","documentation":"GlueIcebergCatalog.setupGlueCatalog instantiates the Iceberg GlueCatalog and calls catalog.initialize(CATALOG_NAME, catalogProperties) inside a try block; any exception there is wrapped in RuntimeException(\"Failed to initialize Glue catalog\"). This fires when the AWS Glue-backed Iceberg catalog cannot start — typically due to missing/invalid AWS configuration (region, credentials, warehouse/catalog properties), missing AWS SDK classes on the classpath, or connectivity/permission failures during initialization.","triggerScenarios":"Creating an Iceberg input source with type=glue when: catalogProperties lack required keys (e.g. warehouse, io-impl, AWS region), the AWS SDK cannot build a Glue client, the JVM context-classloader swap reveals missing AWS SDK dependencies, or the Glue endpoint is unreachable during initialize().","commonSituations":"Missing or invalid druid.iceberg.catalog properties (no warehouse location or region configured); absent or expired AWS credentials in the environment/IAM role; wrong or unset AWS region; GlueCatalog class/dependency version conflicts in the extension classpath; network/proxy blocking the Glue endpoint; insufficient IAM permissions (glue:* on the target catalog).","solutions":["Look at the wrapped cause ('Caused by:' below this RE) for the true error — missing property, credentials, region, or classpath problem — and fix that first.","Verify catalog properties include warehouse, io-impl (e.g. org.apache.iceberg.aws.s3.S3FileIO), and the correct AWS region for your Glue Data Catalog.","Ensure AWS credentials are available (env vars, ~/.aws/credentials, or instance/task IAM role) and the role has glue:GetDatabase/glue:GetTable permissions.","Confirm the druid-iceberg-extensions load spec includes all AWS SDK dependencies and that extension loading is enabled for it in your Druid config.","Test network reachability to the Glue endpoint (glue.<region>.amazonaws.com) from the Druid process; check proxies/VPC endpoints/security groups."],"exampleFix":"// before (inputSourceConfig)\n{\"type\":\"iceberg\",\"catalogProperties\":{\"type\":\"glue\"}}\n// after\n{\"type\":\"iceberg\",\"catalogProperties\":{\"type\":\"glue\",\"warehouse\":\"s3://my-bucket/warehouse/\",\"io-impl\":\"org.apache.iceberg.aws.s3.S3FileIO\",\"client.region\":\"us-east-1\"}}","handlingStrategy":"try-catch","validationCode":"// preflight checks before building the catalog\nassertProp(catalogProperties, \"warehouse\");\nassertProp(catalogProperties, \"io-impl\");\nassertProp(catalogProperties, \"client.region\");\nif (System.getenv(\"AWS_REGION\") == null\n    && System.getProperty(\"aws.region\") == null\n    && catalogProperties.getProperty(\"client.region\") == null) {\n  throw new IllegalStateException(\"AWS region must be set for Glue catalog\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  catalog = createGlueCatalog(catalogProperties);\n} catch (RuntimeException e) {\n  if (e.getMessage().contains(\"Failed to initialize Glue catalog\")) {\n    // inspect e.getCause(): missing prop, NoClassDefFoundError (SDK),\n    // credentials/region failure, or connectivity — remediate accordingly\n  } else {\n    throw e;\n  }\n}","preventionTips":["Always set warehouse, io-impl, and AWS region in catalogProperties for the glue catalog type.","Ensure the AWS SDK jars ship with the druid-iceberg-extensions load spec and verify with a smoke test at startup.","Grant the Druid task/instance IAM role glue:GetDatabase, glue:GetTable, and S3 access to the warehouse bucket.","Log and inspect the wrapped cause immediately — 'Failed to initialize Glue catalog' is only the wrapper, never the root cause.","Validate network access to glue.<region>.amazonaws.com (VPC endpoints, proxy settings) before deployment."],"tags":["aws","glue","catalog-init","iceberg","druid"],"backgroundTag":"module-init-failed","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}