{"record":{"id":"bcd6ab746b26fc91","repo":"apache/hadoop","slug":"could-not-locate-mapreduce-framework-name-in","errorCode":null,"errorMessage":"Could not locate MapReduce framework name '{}' in mapreduce.application.classpath","messagePattern":"Could not locate MapReduce framework name '(.+?)' in mapreduce\\.application\\.classpath","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRApps.java","lineNumber":230,"sourceCode":"        MRApps.addToEnvironment(environment, Environment.CLASSPATH.name(),\n          c.trim(), conf);\n      }\n    }\n\n    boolean foundFrameworkInClasspath = (frameworkName == null);\n    for (String c : conf.getStrings(MRJobConfig.MAPREDUCE_APPLICATION_CLASSPATH,\n        crossPlatform ?\n            StringUtils.getStrings(MRJobConfig.DEFAULT_MAPREDUCE_CROSS_PLATFORM_APPLICATION_CLASSPATH)\n            : StringUtils.getStrings(MRJobConfig.DEFAULT_MAPREDUCE_APPLICATION_CLASSPATH))) {\n      MRApps.addToEnvironment(environment, Environment.CLASSPATH.name(),\n        c.trim(), conf);\n      if (!foundFrameworkInClasspath) {\n        foundFrameworkInClasspath = c.contains(frameworkName);\n      }\n    }\n\n    if (!foundFrameworkInClasspath) {\n      throw new IllegalArgumentException(\n          \"Could not locate MapReduce framework name '\" + frameworkName\n          + \"' in \" + MRJobConfig.MAPREDUCE_APPLICATION_CLASSPATH);\n    }\n    // TODO: Remove duplicates.\n  }\n  \n  @SuppressWarnings(\"deprecation\")\n  public static void setClasspath(Map<String, String> environment,\n      Configuration conf) throws IOException {\n    boolean userClassesTakesPrecedence = \n      conf.getBoolean(MRJobConfig.MAPREDUCE_JOB_USER_CLASSPATH_FIRST, false);\n\n    String classpathEnvVar =\n      conf.getBoolean(MRJobConfig.MAPREDUCE_JOB_CLASSLOADER, false)\n        ? Environment.APP_CLASSPATH.name() : Environment.CLASSPATH.name();\n\n    MRApps.addToEnvironment(environment,\n      classpathEnvVar, crossPlatformifyMREnv(conf, Environment.PWD), conf);","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/util/MRApps.java#L212-L248","documentation":"After deriving the framework name from mapreduce.application.framework.path (URI fragment, else file base name), MRApps checks that this name appears as a substring of at least one entry of mapreduce.application.classpath while building the container classpath. If no classpath entry contains the framework name, it throws IllegalArgumentException — the bundle would be localized but never loadable, since nothing puts it on the classpath.","triggerScenarios":"Configuring mapreduce.application.framework.path=hdfs://nn/x/mr-framework.zip (name 'mr-framework') while mapreduce.application.classpath uses only default entries like $HADOOP_MAPRED_HOME/* that do not contain that name; mismatch between the fragment name and the classpath entry spelling.","commonSituations":"Standing up an alternative MR framework (e.g. a custom/forked MR runtime) and forgetting to add it to mapreduce.application.classpath; renaming the framework jar without updating the classpath; case or version-suffix mismatches between fragment and classpath token.","solutions":["Add a classpath entry containing the framework name, e.g. append $PWD/mr-framework/* or $PWD/mr-framework.zip to mapreduce.application.classpath","Make the fragment in the framework path exactly match the name used in the classpath entry","If you did not intend a custom framework, remove mapreduce.application.framework.path entirely"],"exampleFix":"# before\nmapreduce.application.framework.path = hdfs://nn/dist/mr-framework.zip#mr-framework\nmapreduce.application.classpath = $HADOOP_MAPRED_HOME/*\n\n# after\nmapreduce.application.classpath = $HADOOP_MAPRED_HOME/*,$PWD/mr-framework/*","handlingStrategy":"validation","validationCode":"String fw = conf.get(\"mapreduce.application.framework.path\", \"\");\nif (!fw.isEmpty()) {\n  java.net.URI u = new URI(fw);\n  String name = u.getFragment() != null ? u.getFragment() : new Path(u).getName();\n  boolean found = Arrays.stream(conf.getStrings(\"mapreduce.application.classpath\"))\n      .anyMatch(c -> c.contains(name));\n  if (!found) throw new ConfigException(\"framework name '\" + name + \"' missing from classpath config\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  MRApps.setMRFrameworkClasspath(env, conf);\n} catch (IllegalArgumentException e) {\n  throw new IllegalStateException(\"mapreduce.application.framework.path name must \"\n      + \"appear in mapreduce.application.classpath\", e);\n}","preventionTips":["Whenever you set mapreduce.application.framework.path, add a matching entry ($PWD/<name>/*) to mapreduce.application.classpath","Keep the fragment name and the classpath token byte-identical (watch case and version suffixes)","Unset the framework path entirely when the default MR runtime is intended"],"tags":["hadoop","mapreduce","classpath","framework-path","configuration"],"backgroundTag":"framework-not-in-classpath","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}