{"record":{"id":"2a3d0421dc3c53e4","repo":"apache/hadoop","slug":"s08","errorCode":"S08","errorMessage":"Could not load service classes, {0}","messagePattern":"Could not load service classes, (.+?)","errorType":"error_code","errorClass":"ServerException","httpStatus":null,"severity":"critical","filePath":"hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/server/Server.java","lineNumber":565,"sourceCode":"      List<Service> list = new ArrayList<Service>();\n      loadServices(classes, list);\n      loadServices(classesExt, list);\n\n      //removing duplicate services, strategy: last one wins\n      for (Service service : list) {\n        if (map.containsKey(service.getInterface())) {\n          log.debug(\"Replacing service [{}] implementation [{}]\", service.getInterface(),\n                    service.getClass());\n        }\n        map.put(service.getInterface(), service);\n      }\n      list = new ArrayList<Service>();\n      for (Map.Entry<Class, Service> entry : map.entrySet()) {\n        list.add(entry.getValue());\n      }\n      return list;\n    } catch (RuntimeException ex) {\n      throw new ServerException(ServerException.ERROR.S08, ex.getMessage(), ex);\n    }\n  }\n\n  /**\n   * Initializes the list of services.\n   *\n   * @param services services to initialized, it must be a de-dupped list of\n   * services.\n   *\n   * @throws ServerException thrown if the services could not be initialized.\n   */\n  protected void initServices(List<Service> services) throws ServerException {\n    for (Service service : services) {\n      log.debug(\"Initializing service [{}]\", service.getInterface());\n      checkServiceDependencies(service);\n      service.init(this);\n      this.services.put(service.getInterface(), service);\n    }","sourceCodeStart":547,"sourceCodeEnd":583,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/lib/server/Server.java#L547-L583","documentation":"HttpFS Server loads its service class list by calling Configuration.getClasses() on the 'httpfs.services' and 'httpfs.services.ext' properties, then de-dups implementations by their Service interface. Error S08 ('Could not load service classes') wraps any RuntimeException escaping that load phase - in practice almost always a ClassNotFoundException raised by Configuration.getClasses() because a class named in those properties is not on the webapp classpath.","triggerScenarios":"Server startup calls getConfig().getClasses(getPrefixedName(\"services\")) / (\"services.ext\"); a fully-qualified class name listed in httpfs.services or httpfs.services.ext cannot be loaded (missing jar, renamed class, typo), so getClasses throws a RuntimeException which is wrapped as S08.","commonSituations":"A jar was removed from share/hadoop/httpfs/tomcat/webapp/WEB-INF/lib but its class names remain in httpfs.services; a Hadoop upgrade renamed or moved a service class; a typo in the property value; duplicate/conflicting jars hiding the class.","solutions":["Check the chained cause - it names the exact class that failed to load","Verify each class listed in httpfs.services/httpfs.services.ext exists on the webapp classpath (WEB-INF/lib or the httpfs tomcat lib directory)","Fix or remove stale entries from the properties","Redeploy a consistent set of jars (do not mix Hadoop versions) and restart"],"exampleFix":"<!-- before: httpfs.services references a class that no longer exists -->\n<property><name>httpfs.services</name>\n  <value>org.apache.hadoop.lib.service.instrumentation.InstrumentationService,\n         com.myco.removed.OldService</value></property>\n\n<!-- after -->\n<property><name>httpfs.services</name>\n  <value>org.apache.hadoop.lib.service.instrumentation.InstrumentationService</value></property>","handlingStrategy":"validation","validationCode":"for (String name : config.getStrings(\"httpfs.services\", new String[0])) {\n  Class.forName(name.trim()); // fails fast with ClassNotFoundException before server start\n}","typeGuard":null,"tryCatchPattern":"try {\n  server.init();\n} catch (ServerException ex) {\n  if (ex.getError() == ServerException.ERROR.S08) {\n    Throwable cause = ex.getCause(); // usually RuntimeException wrapping ClassNotFoundException\n    log.error(\"service class list failed to load: {}\", cause, ex);\n  }\n  throw ex;\n}","preventionTips":["Treat httpfs.services as code: update it in the same change that adds/removes a service jar","Automate a pre-deploy check that Class.forName() succeeds for every listed class on the webapp classpath","Never mix service jars from different Hadoop distributions","Deploy jars and the services property together (atomic deployment)"],"tags":["httpfs","classpath","service-loader","startup","class-not-found"],"backgroundTag":"class-not-found","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}