{"record":{"id":"7113d7bf0e4d75f0","repo":"apache/druid","slug":"shutdown-callback-registry-expected-class-s-fou","errorCode":null,"errorMessage":"Shutdown callback registry expected class [%s] found [%s]. Skipping shutdown registry","messagePattern":"Shutdown callback registry expected class \\[(.+?)\\] found \\[(.+?)\\]\\. Skipping shutdown registry","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/src/main/java/org/apache/druid/initialization/Log4jShutterDownerModule.java","lineNumber":69,"sourceCode":"      }\n      // Reflection to try and allow non Log4j2 stuff to run. This acts as a gateway to stop errors in the next few lines\n      // In log4j api\n      Class.forName(\"org.apache.logging.log4j.LogManager\", false, loader);\n      // In log4j core\n      Class.forName(\"org.apache.logging.log4j.core.util.ShutdownCallbackRegistry\", false, loader);\n\n      final LoggerContextFactory contextFactory = LogManager.getFactory();\n      if (!(contextFactory instanceof Log4jContextFactory)) {\n        log.warn(\n            \"Expected [%s] found [%s]. Unknown class for context factory. Not logging shutdown\",\n            Log4jContextFactory.class.getName(),\n            contextFactory.getClass().getName()\n        );\n        return;\n      }\n      final ShutdownCallbackRegistry registry = ((Log4jContextFactory) contextFactory).getShutdownCallbackRegistry();\n      if (!(registry instanceof Log4jShutdown)) {\n        log.warn(\n            \"Shutdown callback registry expected class [%s] found [%s]. Skipping shutdown registry\",\n            Log4jShutdown.class.getName(),\n            registry.getClass().getName()\n        );\n        return;\n      }\n      binder.bind(Log4jShutdown.class).toInstance((Log4jShutdown) registry);\n      binder.bind(Key.get(Log4jShutterDowner.class, Names.named(\"ForTheEagerness\")))\n            .to(Log4jShutterDowner.class)\n            .asEagerSingleton();\n    }\n    catch (ClassNotFoundException | ClassCastException | LinkageError e) {\n      log.warn(e, \"Not registering log4j shutdown hooks. Not using log4j?\");\n    }\n  }\n\n\n  @ManageLifecycleInit","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/initialization/Log4jShutterDownerModule.java#L51-L87","documentation":"After confirming a Log4jContextFactory, the module asks it for its ShutdownCallbackRegistry and requires it to be Druid's Log4jShutdown class to hook lifecycle-managed shutdown. If log4j was configured with a custom shutdownCallbackRegistry, the default registry type is returned instead, so Druid skips installing its shutdown hooks and warns.","triggerScenarios":"configure() calls ((Log4jContextFactory) contextFactory).getShutdownCallbackRegistry() and the registry is not a Log4jShutdown — caused by setting the log4j2 system property log4j.shutdownCallbackRegistry to a custom registry class, or bundling a library that overrides it.","commonSituations":"Custom log4j2.component.properties shipping ShutdownCallbackRegistry overrides; shaded jars embedding their own registry; mixing Druid versions whose Log4jShutdown differs from the one log4j instantiates.","solutions":["Remove any log4j2.shutdownCallbackRegistry / log4j.shutdownCallbackRegistry property from log4j2.component.properties or system properties so log4j uses Druid's Log4jShutdown","Check the classpath for duplicate log4j-core jars that may carry a different default registry","Align Druid server module and extension versions so the Log4jShutdown class matches the one log4j loads"],"exampleFix":"// before: log4j2.component.properties\nlog4j.shutdownCallbackRegistry=com.example.MyShutdownRegistry\n// after\n(property removed, letting Druid's Log4jShutdown be the registry)","handlingStrategy":"validation","validationCode":"final String reg = System.getProperty(\"log4j.shutdownCallbackRegistry\", System.getenv(\"LOG4J_SHUTDOWN_CALLBACK_REGISTRY\") != null ? System.getenv(\"LOG4J_SHUTDOWN_CALLBACK_REGISTRY\") : \"org.apache.druid.server.logging.Log4jShutdown\"); boolean ok = reg.endsWith(\"Log4jShutdown\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never set log4j.shutdownCallbackRegistry in log4j2.component.properties for Druid","Keep log4j-core at the version Druid expects","Diff log4j2.component.properties against the stock Druid config after upgrades"],"tags":["logging","log4j","shutdown","configuration"],"backgroundTag":"invalid-config-value","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}