{"record":{"id":"44d36b019e1269b1","repo":"apache/hadoop","slug":"exit-service-creation-failure-56","errorCode":"EXIT_SERVICE_CREATION_FAILURE(56)","errorMessage":"Could not create ${classname} because it is not a Configuration class/subclass","messagePattern":"Could not create (.+?) because it is not a Configuration class/subclass","errorType":"exception","errorClass":"ExitUtil.ExitException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/service/launcher/ServiceLauncher.java","lineNumber":431,"sourceCode":"  /**\n   * @return This creates all the configurations defined by\n   * {@link #getConfigurationsToCreate()} , ensuring that\n   * the resources have been pushed in.\n   * If one cannot be loaded it is logged and the operation continues\n   * except in the case that the class does load but it isn't actually\n   * a subclass of {@link Configuration}.\n   * @throws ExitUtil.ExitException if a loaded class is of the wrong type\n   */\n  @VisibleForTesting\n  public int loadConfigurationClasses() {\n    List<String> toCreate = getConfigurationsToCreate();\n    int loaded = 0;\n    for (String classname : toCreate) {\n      try {\n        Class<?> loadClass = getClassLoader().loadClass(classname);\n        Object instance = loadClass.getConstructor().newInstance();\n        if (!(instance instanceof Configuration)) {\n          throw new ExitUtil.ExitException(EXIT_SERVICE_CREATION_FAILURE,\n              \"Could not create \" + classname\n              + \" because it is not a Configuration class/subclass\");\n        }\n        loaded++;\n      } catch (ClassNotFoundException e) {\n        // class could not be found -implies it is not on the current classpath\n        LOG.debug(\"Failed to load {} because it is not on the classpath\",\n            classname);\n      } catch (ExitUtil.ExitException e) {\n        // rethrow\n        throw e;\n      } catch (Exception e) {\n        // any other exception\n        LOG.info(\"Failed to create {}\", classname, e);\n      }\n    }\n    return loaded;\n  }","sourceCodeStart":413,"sourceCodeEnd":449,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/service/launcher/ServiceLauncher.java#L413-L449","documentation":"ServiceLauncher.loadConfigurationClasses() instantiates every configuration class named in the launcher's configuration-class list (confClassnames, e.g. the --confclass launch argument) so their static resources load. ClassNotFound is skipped at DEBUG (not on classpath is fine), any other instantiation error is logged and skipped - but a class that loads and constructs yet is not an instanceof org.apache.hadoop.conf.Configuration triggers ExitUtil.ExitException EXIT_SERVICE_CREATION_FAILURE (56): \"Could not create <classname> because it is not a Configuration class/subclass\", and the launcher exits with code 56.","triggerScenarios":"Passing a class to the launcher's configuration-class list that is on the classpath and has a public no-arg constructor but does not extend Configuration - e.g. a settings/constants class, a YarnConfiguration lookalike from the wrong package, or a class whose simple name collides with the intended Configuration subclass.","commonSituations":"Hand-built launch commands with --confclass entries; fat jars where a different same-named class shadows the intended Configuration subclass; copy-paste from docs pointing at non-Configuration classes.","solutions":["Remove the offending entry or replace it with a class that actually extends org.apache.hadoop.conf.Configuration (e.g. org.apache.hadoop.yarn.conf.YarnConfiguration).","Check for shadowing: run the class with -verbose:class or inspect the fat jar for duplicate class names.","Confirm the class has a public no-arg constructor; classes failing instantiation are merely logged, so the 56 exit specifically means wrong type."],"exampleFix":"# before\nhadoop ... --confclass org.example.AppConstants   # loads, but not a Configuration\n# exit code 56: \"Could not create org.example.AppConstants because it is not a Configuration class/subclass\"\n# after\nhadoop ... --confclass org.apache.hadoop.yarn.conf.YarnConfiguration","handlingStrategy":"type-guard","validationCode":"for (String name : confClassnames) {\n  Class<?> c = Class.forName(name, false, getClass().getClassLoader());\n  if (!Configuration.class.isAssignableFrom(c)) {\n    LOG.warn(\"Skipping non-Configuration class {}\", name);\n  }\n}","typeGuard":"static Optional<Class<? extends Configuration>> asConfigurationClass(\n    String name, ClassLoader cl) {\n  try {\n    Class<?> c = cl.loadClass(name);\n    return Configuration.class.isAssignableFrom(c)\n        ? Optional.of(c.asSubclass(Configuration.class))\n        : Optional.empty();\n  } catch (ClassNotFoundException e) {\n    return Optional.empty();\n  }\n}","tryCatchPattern":null,"preventionTips":["Only list classes that provably extend org.apache.hadoop.conf.Configuration in the launcher's configuration-class argument.","Verify with javap or a unit test that each listed class is a Configuration subclass with a public no-arg ctor.","Beware fat-jar shadowing producing same-named non-Configuration classes."],"tags":["service-launcher","configuration","classpath","exit-code-56"],"backgroundTag":"class-type-mismatch","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}