apache/pulsar · critical · PulsarClientException

pulsarWebServiceUrl cannot be null

Error message

pulsarWebServiceUrl cannot be null

What it means

createPulsarAdminClient builds a PulsarAdmin from a web service URL plus auth/TLS config. If pulsarWebServiceUrl is null the builder cannot be completed and it throws PulsarClientException("pulsarWebServiceUrl cannot be null"). Like the client-URL check, this signals missing instance configuration for the admin HTTP endpoint.

Source

Thrown at pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/InstanceUtils.java:220

            throws PulsarClientException {
        PulsarAdminBuilder pulsarAdminBuilder = null;
        if (isNotBlank(pulsarWebServiceUrl)) {
            pulsarAdminBuilder = PulsarAdmin.builder().serviceHttpUrl(pulsarWebServiceUrl);
            if (authConfig != null) {
                if (isNotBlank(authConfig.getClientAuthenticationPlugin())
                        && isNotBlank(authConfig.getClientAuthenticationParameters())) {
                    pulsarAdminBuilder.authentication(authConfig.getClientAuthenticationPlugin(),
                            authConfig.getClientAuthenticationParameters());
                }
                if (isNotBlank(authConfig.getTlsTrustCertsFilePath())) {
                    pulsarAdminBuilder.tlsTrustCertsFilePath(authConfig.getTlsTrustCertsFilePath());
                }
                pulsarAdminBuilder.allowTlsInsecureConnection(authConfig.isTlsAllowInsecureConnection());
                pulsarAdminBuilder.enableTlsHostnameVerification(authConfig.isTlsHostnameVerificationEnable());
            }
            return pulsarAdminBuilder.build();
        }
        throw new PulsarClientException("pulsarWebServiceUrl cannot be null");
    }
}

View on GitHub (pinned to 820761864e)

Solutions

  1. Set pulsarWebServiceUrl (e.g. http://broker:8080) in the instance launch arguments/config.
  2. Verify the function worker's webServiceUrl/brokerWebServiceUrl configuration is populated and propagated.
  3. In programmatic setups, pass the admin HTTP URL explicitly to createPulsarAdminClient.

Example fix

// before
InstanceUtils.createPulsarAdminClient(null, authConfig);
// after
InstanceUtils.createPulsarAdminClient("http://localhost:8080", authConfig);
Defensive patterns

Strategy: validation

Validate before calling

if (pulsarWebServiceUrl == null || pulsarWebServiceUrl.isBlank()) {
    throw new IllegalArgumentException("pulsarWebServiceUrl must be set (e.g. http://broker:8080)");
}

Try / catch

try { admin = InstanceUtils.createPulsarAdminClient(url, authConfig); } catch (PulsarClientException e) { if (e.getMessage().contains("cannot be null")) { throw new IllegalStateException("Instance config missing pulsarWebServiceUrl", e); } throw e; }

Prevention

When it happens

Trigger: createPulsarAdminClient(null, authConfig, ...) — the instance config's pulsarWebServiceUrl was null, e.g. the launcher omitted the web service URL or the worker config lacks it.

Common situations: Missing `--pulsarWebServiceUrl` argument in function instance launch; worker config missing brokerWebServiceUrl; custom instance setups (tests, embedded runtimes) that only set the binary service URL.

Related errors


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