{"record":{"id":"1b73b1e4dd2e5933","repo":"apache/hadoop","slug":"class-not-instance-of","errorCode":null,"errorMessage":"Class: {} not instance of {}","messagePattern":"Class: (.+?) not instance of (.+?)","errorType":"exception","errorClass":"ResourceEstimatorException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-resourceestimator/src/main/java/org/apache/hadoop/resourceestimator/common/config/ResourceEstimatorUtil.java","lineNumber":67,"sourceCode":"  @SuppressWarnings(\"unchecked\") public static <T> T createProviderInstance(\n      Configuration conf, String configuredClassName, String defaultValue,\n      Class<T> type) throws ResourceEstimatorException {\n    String className = conf.get(configuredClassName);\n    if (className == null) {\n      className = defaultValue;\n    }\n    try {\n      Class<?> concreteClass = Class.forName(className);\n      if (type.isAssignableFrom(concreteClass)) {\n        Constructor<T> meth =\n            (Constructor<T>) concreteClass.getDeclaredConstructor(EMPTY_ARRAY);\n        meth.setAccessible(true);\n        return meth.newInstance();\n      } else {\n        StringBuilder errMsg = new StringBuilder();\n        errMsg.append(\"Class: \").append(className).append(\" not instance of \")\n            .append(type.getCanonicalName());\n        throw new ResourceEstimatorException(errMsg.toString());\n      }\n    } catch (ClassNotFoundException e) {\n      StringBuilder errMsg = new StringBuilder();\n      errMsg.append(\"Could not instantiate : \").append(className)\n          .append(\" due to exception: \").append(e.getCause());\n      throw new ResourceEstimatorException(errMsg.toString());\n    } catch (ReflectiveOperationException e) {\n      StringBuilder errMsg = new StringBuilder();\n      errMsg.append(\"Could not instantiate : \").append(className)\n          .append(\" due to exception: \").append(e.getCause());\n      throw new ResourceEstimatorException(errMsg.toString());\n    }\n  }\n}\n","sourceCodeStart":49,"sourceCodeEnd":82,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-resourceestimator/src/main/java/org/apache/hadoop/resourceestimator/common/config/ResourceEstimatorUtil.java#L49-L82","documentation":"Error \"Class: {} not instance of {}\" thrown in apache/hadoop.","triggerScenarios":"A class configured in the resource estimator configuration does not implement the expected interface/superclass, so it cannot be used as the configured component.","commonSituations":"See trigger scenarios.","solutions":["Configure a class that actually implements/extends the expected interface for this resource estimator setting."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}