apache/dubbo · error · IllegalStateException

<config>.<key> == null

Error message

<config>.<key> == null

What it means

Thrown by AbstractConfig.appendParameters0 when building URL parameters from a config bean: a getter annotated @Parameter(required = true) returned null or an empty string while asParameters is true. Dubbo refuses to build the URL because a mandatory attribute is unset.

Source

Thrown at dubbo-common/src/main/java/org/apache/dubbo/config/AbstractConfig.java:245

                    if (value != null && str.length() > 0) {
                        if (asParameters && parameter != null && parameter.escaped()) {
                            str = URL.encode(str);
                        }
                        if (parameter != null && parameter.append()) {
                            String pre = parameters.get(key);
                            if (pre != null && pre.length() > 0) {
                                str = pre + "," + str;
                                // Remove duplicate values
                                Set<String> set = StringUtils.splitToSet(str, ',');
                                str = StringUtils.join(set, ",");
                            }
                        }
                        if (prefix != null && prefix.length() > 0) {
                            key = prefix + "." + key;
                        }
                        parameters.put(key, str);
                    } else if (asParameters && parameter != null && parameter.required()) {
                        throw new IllegalStateException(config.getClass().getSimpleName() + "." + key + " == null");
                    }
                } else if (isParametersGetter(method)) {
                    Map<String, String> map = (Map<String, String>) method.invoke(config);
                    map = convert(map, prefix);
                    if (asParameters) {
                        // put all parameters to url
                        parameters.putAll(map);
                    } else {
                        // encode parameters to string for config overriding, see AbstractConfig#refresh()
                        String key = calculatePropertyFromGetter(name);
                        String encodeParameters = StringUtils.encodeParameters(map);
                        if (encodeParameters != null) {
                            parameters.put(key, encodeParameters);
                        }
                    }
                } else if (isNestedGetter(config, method)) {
                    Object inner = method.invoke(config);
                    String fieldName = MethodUtils.extractFieldName(method);

View on GitHub (pinned to 3a3043227f)

Solutions

  1. Read the message: '<ConfigClass>.<key> == null' names the exact config and attribute — set that property.
  2. Provide the value in your config source (application.yml, dubbo.properties, or Spring XML) under the correct prefix/key.
  3. If configuring programmatically, call the corresponding setter before export()/reference().
  4. If the field should be optional, review whether @Parameter(required=true) is appropriate for your use case.

Example fix

// before
ServiceConfig<GreetingService> svc = new ServiceConfig<>();
svc.setRef(new GreetingImpl());
// interface never set -> required param null
svc.export();
// after
svc.setInterface(GreetingService.class);
svc.export();
Defensive patterns

Strategy: validation

Validate before calling

// before export/reference, ensure required params are set
void assertRequired(ServiceConfig<?> svc) {
    if (svc.getInterface() == null) throw new IllegalStateException("interface required");
    // add checks for any @Parameter(required=true) fields you rely on
}

Try / catch

try {
    serviceConfig.export();
} catch (IllegalStateException e) {
    if (e.getMessage().endsWith(" == null")) { /* set the named required attribute */ }
    throw e;
}

Prevention

When it happens

Trigger: A config bean (ServiceConfig, ReferenceConfig, ProtocolConfig, RegistryConfig, etc.) has a field marked @Parameter(required=true) whose getter returns null/empty during URL assembly (export/reference startup). Example: a required attribute like 'interface' or a custom required parameter was never set.

Common situations: A required config property was not specified in application.properties/dubbo.properties/Spring XML. A programmatic config object was created without calling the setter for a required field. A property placeholder (${...}) for a required attribute failed to resolve.

Related errors


AI-assisted analysis of apache/dubbo@3a3043227f (2026-08-14). Data as JSON: /api/errors/94325732befec3e6. Report an issue: GitHub.