apache/pulsar · error · NotImplementedException

Deprecated; use EncodedAuthenticationParameterSupport

Error message

Deprecated; use EncodedAuthenticationParameterSupport

What it means

The legacy Map<String,String>-based configure() entry point of AuthenticationOAuth2 has been deprecated and intentionally stubbed. Any caller invoking it gets an immediate NotImplementedException telling them to migrate to EncodedAuthenticationParameterSupport, which supports URL-encoded authentication parameters.

Source

Thrown at pulsar-client/src/main/java/org/apache/pulsar/client/impl/auth/oauth2/AuthenticationOAuth2.java:244

                percent = Double.parseDouble(value);
            } else {
                percent = Integer.parseInt(value) / 100.0;
            }
            if (percent <= 0) {
                throw new IllegalArgumentException(
                        CONFIG_PARAM_EARLY_TOKEN_REFRESH_PERCENT + " must be greater than 0, got: " + value);
            }
            return percent;
        } catch (NumberFormatException e) {
            throw new IllegalArgumentException(
                    "Malformed configuration parameter: " + CONFIG_PARAM_EARLY_TOKEN_REFRESH_PERCENT, e);
        }
    }

    @Override
    @Deprecated
    public void configure(Map<String, String> authParams) {
        throw new NotImplementedException("Deprecated; use EncodedAuthenticationParameterSupport");
    }

    @Override
    public void start() throws PulsarClientException {
        flow.initialize();
    }

    /**
     * The first time that this method is called, it retrieves a token. All subsequent
     * calls should get a cached value. However, if there is an issue with the Identity
     * Provider, there is a chance that the background thread responsible for keeping
     * the refresh token hot will
     * @return The authentication data identifying this client that will be sent to the broker
     * @throws PulsarClientException
     */
    @SuppressWarnings("deprecation")
    @Override
    public synchronized AuthenticationDataProvider getAuthData() throws PulsarClientException {

View on GitHub (pinned to 820761864e)

Solutions

  1. Implement EncodedAuthenticationParameterSupport and use configure(String encodedAuthParamString) instead
  2. Pass auth parameters through the AuthenticationFactory or client builder rather than the deprecated map API
  3. Update custom code that calls configure(Map) to the encoded-string variant

Example fix

// before
auth.configure(authParamsMap);
// after
if (auth instanceof EncodedAuthenticationParameterSupport) {
    ((EncodedAuthenticationParameterSupport) auth).configure("{\"issuerUrl\":\"...\",\"privateKey\":\"...\"}");
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (auth instanceof EncodedAuthenticationParameterSupport) {
    ((EncodedAuthenticationParameterSupport) auth).configure(encodedParams);
} else {
    auth.configure(authParams); // legacy path only if still supported
}

Type guard

boolean supportsEncodedParams(Authentication a) { return a instanceof EncodedAuthenticationParameterSupport; }

Try / catch

try {
    auth.configure(authParams);
} catch (NotImplementedException e) {
    // migrate: use EncodedAuthenticationParameterSupport.configure(String)
}

Prevention

When it happens

Trigger: Calling authentication.configure(Map) directly; older client code or plugins wiring auth via the pre-2.x map-based Authentication API; frameworks that still invoke configure() reflectively.

Common situations: Upgrading Pulsar client versions where the deprecated method became a hard stub; copy-pasted custom Authentication implementations modeled on old samples.

Understand the failure class

Related errors


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/73f0063692d6e706. Report an issue: GitHub.