apache/pulsar · error · org.apache.pulsar.client.impl.v5.PulsarClientException

${e.getMessage()}

Error message

${e.getMessage()}

What it means

createAuthentication(String className, String params) delegates to V5AuthenticationLoader.create; if the loader cannot instantiate the requested authentication plugin (unknown class name, missing plugin on classpath, or invalid params), it throws a PulsarClientException which is re-thrown here with the loader's original message and cause preserved. The message text is dynamic — it is whatever the underlying loader failure reported.

Source

Thrown at pulsar-client-v5/src/main/java/org/apache/pulsar/client/impl/v5/PulsarClientProviderV5.java:197

    }

    @Override
    public Authentication authenticationToken(Supplier<String> tokenSupplier) {
        return new TokenAuthenticationV5(tokenSupplier);
    }

    @Override
    public Authentication authenticationTls() {
        return new TlsAuthentication();
    }

    @Override
    public Authentication createAuthentication(String className, String params)
            throws PulsarClientException {
        try {
            return V5AuthenticationLoader.create(className, params);
        } catch (org.apache.pulsar.client.api.PulsarClientException e) {
            throw new PulsarClientException(e.getMessage(), e);
        }
    }

    @Override
    public Authentication createAuthentication(String className, Map<String, String> params)
            throws PulsarClientException {
        try {
            return V5AuthenticationLoader.create(className, params);
        } catch (org.apache.pulsar.client.api.PulsarClientException e) {
            throw new PulsarClientException(e.getMessage(), e);
        }
    }
}

View on GitHub (pinned to 820761864e)

Solutions

  1. Read the exception message/cause to see whether the plugin class was not found or the params were invalid
  2. Verify the authentication plugin class name matches exactly what the loader supports (check V5AuthenticationLoader's supported names)
  3. Ensure the plugin JAR is on the client classpath and the params string is valid for that plugin

Example fix

// before
provider.createAuthentication("org.apache.pulsar.AuthToken", "file:///missing/token");
// after
provider.createAuthentication("org.apache.pulsar.client.impl.auth.AuthenticationToken",
    "file:///etc/pulsar/token.txt");
Defensive patterns

Strategy: try-catch

Validate before calling

if (className == null || className.isBlank()) throw new IllegalArgumentException("auth className required");
if (params == null || params.isBlank()) throw new IllegalArgumentException("auth params required");

Try / catch

try {
    Authentication auth = provider.createAuthentication(className, params);
} catch (PulsarClientException e) {
    log.error("Auth plugin load failed: {}", e.getMessage(), e.getCause());
}

Prevention

When it happens

Trigger: Calling PulsarClientProviderV5.createAuthentication(className, params) where className does not match a registered/available authentication plugin, or the params string cannot be parsed by that plugin (e.g. malformed JSON or missing required fields like the role token or certificate path).

Common situations: Typo in the fully-qualified plugin class name; authentication plugin JAR not on the client classpath; passing params in the wrong format after migrating from an older client version; configuring OAuth2 or JWT auth with a missing key file path.

Related errors


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