apache/hadoop · error · RuntimeException

Error parsing resource {}: XInclude is not supported for res

Error message

Error parsing resource {}: XInclude is not supported for restricted resources

What it means

Error "Error parsing resource {}: XInclude is not supported for restricted resources" thrown in apache/hadoop.

Source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java:3298

      }
    }

    private void handleInclude() throws XMLStreamException, IOException {
      // Determine href for xi:include
      confInclude = null;
      int attrCount = reader.getAttributeCount();
      List<ParsedItem> items;
      for (int i = 0; i < attrCount; i++) {
        String attrName = reader.getAttributeLocalName(i);
        if ("href".equals(attrName)) {
          confInclude = reader.getAttributeValue(i);
        }
      }
      if (confInclude == null) {
        return;
      }
      if (isRestricted) {
        throw new RuntimeException("Error parsing resource " + wrapper
            + ": XInclude is not supported for restricted resources");
      }
      // Determine if the included resource is a classpath resource
      // otherwise fallback to a file resource
      // xi:include are treated as inline and retain current source
      URL include = getResource(confInclude);
      if (include != null) {
        Resource classpathResource = new Resource(include, name,
            wrapper.isParserRestricted());
        // This is only called recursively while the lock is already held
        // by this thread, but synchronizing avoids a findbugs warning.
        synchronized (Configuration.this) {
          XMLStreamReader2 includeReader =
              getStreamReader(classpathResource, quiet);
          if (includeReader == null) {
            throw new RuntimeException(classpathResource + " not found");
          }
          items = new Parser(includeReader, classpathResource, quiet).parse();

View on GitHub (pinned to 2add963021)

Solutions

  1. Remove XInclude directives from configuration resources loaded from restricted (non-file) sources.

Example fix

Inline the included content instead of using xi:include.

When it happens

Trigger: Raised at runtime when the documented precondition or configuration requirement for this operation is violated.

Common situations: Misconfigured or missing property, invalid user input, or calling the API before its prerequisites are met.


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/00b0b961669658bf. Report an issue: GitHub.