{"record":{"id":"18735dc51a424027","repo":"apache/hadoop","slug":"could-not-find-configured-fencing-method","errorCode":null,"errorMessage":"Could not find configured fencing method {}","messagePattern":"Could not find configured fencing method (.+?)","errorType":"exception","errorClass":"BadFencingConfigurationException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/NodeFencer.java","lineNumber":180,"sourceCode":"      throw new BadFencingConfigurationException(\n          \"Unable to parse line: '\" + line + \"'\");\n    }\n  }\n\n  private static FenceMethodWithArg createFenceMethod(\n      Configuration conf, String clazzName, String arg)\n      throws BadFencingConfigurationException {\n\n    Class<?> clazz;\n    try {\n      // See if it's a short name for one of the built-in methods\n      clazz = STANDARD_METHODS.get(clazzName);\n      if (clazz == null) {\n        // Try to instantiate the user's custom method\n        clazz = Class.forName(clazzName);\n      }\n    } catch (Exception e) {\n      throw new BadFencingConfigurationException(\n          \"Could not find configured fencing method \" + clazzName,\n          e);\n    }\n    \n    // Check that it implements the right interface\n    if (!FenceMethod.class.isAssignableFrom(clazz)) {\n      throw new BadFencingConfigurationException(\"Class \" + clazzName +\n          \" does not implement FenceMethod\");\n    }\n    \n    FenceMethod method = (FenceMethod)ReflectionUtils.newInstance(\n        clazz, conf);\n    method.checkArgs(arg);\n    return new FenceMethodWithArg(method, arg);\n  }\n  \n  private static class FenceMethodWithArg {\n    private final FenceMethod method;","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/NodeFencer.java#L162-L198","documentation":"NodeFencer.createFenceMethod() wraps ClassNotFoundException (or any Exception from Class.forName) in BadFencingConfigurationException('Could not find configured fencing method <name>') when the configured fencing class cannot be resolved — it is neither a built-in short name in STANDARD_METHODS (sshfence, shell) nor a loadable class on the classpath.","triggerScenarios":"An entry in dfs.ha.fencing.methods names a class that cannot be loaded: typo in the name, jar missing from the classpath, or a short name that does not exist (only 'sshfence' and 'shell' are built in).","commonSituations":"Custom FenceMethod jar not deployed to every node that may run fencing; typo or wrong case in the class name; Hadoop upgrade that moved/renamed the class; using a short name introduced in a newer version on an older cluster.","solutions":["Use the built-in short names 'sshfence' or 'shell' when they suffice.","For a custom method, write the fully-qualified class name and deploy its jar to all HA nodes (same path on each), then verify with 'hadoop classpath' and a Class.forName load test.","Check spelling and case of the class name against the jar contents."],"exampleFix":"<!-- before: short name that does not exist / typo -->\n<value>myfencer</value>\n\n<!-- after: fully-qualified class shipped on all nodes -->\n<value>com.example.ha.MyFenceMethod</value>","handlingStrategy":"validation","validationCode":"// Verify the fencing class resolves on THIS node before enabling HA\nString name = \"com.example.ha.MyFenceMethod\";\nClass<?> clazz = Class.forName(name); // ClassNotFoundException if missing\nif (!org.apache.hadoop.ha.FenceMethod.class.isAssignableFrom(clazz)) {\n  throw new IllegalStateException(name + \" is not a FenceMethod\");\n}","typeGuard":"boolean isLoadableFenceMethod(String n) throws ClassNotFoundException {\n  return org.apache.hadoop.ha.FenceMethod.class.isAssignableFrom(Class.forName(n));\n}","tryCatchPattern":"try {\n  new NodeFencer(conf, fencingConfig);\n} catch (BadFencingConfigurationException e) {\n  if (e.getCause() instanceof ClassNotFoundException) {\n    // jar missing on this node: deploy it before failover is ever needed\n  }\n}","preventionTips":["Deploy custom fencer jars to every node that may run fencing, via the same package path, and assert presence in provisioning.","Use fully-qualified class names in config; short names only for the built-ins sshfence/shell.","Run a Class.forName smoke test per node during deployment."],"tags":["hadoop","configuration","fencing","classpath","class-not-found"],"backgroundTag":"class-not-found","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}