apache/hadoop · error · TokenAccessProviderException

Unable to load custom token provider class

Error message

Unable to load custom token provider class: {e}

What it means

Catch-all wrap: an unexpected Exception (classloading, static init failure, security) escaped while resolving/instantiating the custom token provider for Custom auth; the original cause is chained for diagnosis.

Solutions

  1. Ensure the custom token provider class named in configuration is on the classpath and can be loaded.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AbfsConfiguration.java:1600 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AbfsConfiguration.java:1600

            CustomTokenProviderAdaptee.class);

        if (customTokenProviderClass == null) {
          throw new IllegalArgumentException(
                  String.format("The configuration value for \"%s\" is invalid.", configKey));
        }
        CustomTokenProviderAdaptee azureTokenProvider = ReflectionUtils
                .newInstance(customTokenProviderClass, rawConfig);
        if (azureTokenProvider == null) {
          throw new IllegalArgumentException("Failed to initialize " + customTokenProviderClass);
        }
        LOG.trace("Initializing {}", customTokenProviderClass.getName());
        azureTokenProvider.initialize(rawConfig, accountName);
        LOG.trace("{} init complete", customTokenProviderClass.getName());
        return new CustomTokenProviderAdapter(azureTokenProvider, getCustomTokenFetchRetryCount());
      } catch(IllegalArgumentException e) {
        throw e;
      } catch (Exception e) {
        throw new TokenAccessProviderException("Unable to load custom token provider class: " + e, e);
      }

    } else {
      throw new TokenAccessProviderException(String.format(
              "Invalid auth type: %s is being used, expecting OAuth", authType));
    }
  }

  /**
   * Returns the SASTokenProvider implementation to be used to generate SAS token.<br>
   * Users can choose between a custom implementation of {@link SASTokenProvider}
   * or an in house implementation {@link FixedSASTokenProvider}.<br>
   * For Custom implementation "fs.azure.sas.token.provider.type" needs to be provided.<br>
   * For Fixed SAS Token use "fs.azure.sas.fixed.token" needs to be provided.<br>
   * In case both are provided, Preference will be given to Custom implementation.<br>
   * Avoid using a custom tokenProvider implementation just to read the configured
   * fixed token, as this could create confusion. Also,implementing the SASTokenProvider
   * requires relying on the raw configurations. It is more stable to depend on

View on GitHub (pinned to 2add963021)