apache/shenyu · error · ShenyuException

shared thread pool is not enable, config

Error message

shared thread pool is not enable, config ${shenyu.sharedPool.enable} in your xml/yml !

What it means

The Apache Dubbo plugin's SharedThreadPool tries to fetch the ShenyuThreadPoolExecutor Spring bean to share the gateway's thread pool with Dubbo requests. When that bean doesn't exist (NoSuchBeanDefinitionException) — because shared pool support was never enabled — it throws a ShenyuException telling the user to set shenyu.sharedPool.enable.

Solutions

  1. Set shenyu.sharedPool.enable: true in the gateway's application.yml so ShenyuThreadPoolExecutor is registered.
  2. Verify shenyu-spring-boot-starter(-gateway) runtime components that create ShenyuThreadPoolExecutor are on the classpath.
  3. Alternatively change the dubbo plugin's threadpool config from 'shared' to 'cached' or another supported type.
  4. Restart the gateway after changing config so the bean is created before any dubbo call.

Example fix

// before (application.yml)
shenyu:
  threadPool:
    enable: false
// after
shenyu:
  sharedPool:
    enable: true
Defensive patterns

Strategy: validation

Validate before calling

// before starting dubbo calls, check the bean exists
ApplicationContext ctx = SpringBeanUtils.getInstance().getApplicationContext();
boolean shared = ctx.getBeansOfType(ShenyuThreadPoolExecutor.class).size() > 0;
if (!shared && "shared".equals(threadpool)) {
    throw new IllegalStateException("enable shenyu.sharedPool.enable=true");
}

Try / catch

try {
    Executor exec = sharedThreadPool.getExecutor(url);
} catch (ShenyuException e) {
    LOG.error("shared pool missing, falling back: {}", e.getMessage());
    Executor exec2 = new CachedThreadPool().getExecutor(url);
}

Prevention

When it happens

Trigger: A dubbo selector/rule (or plugin threadpool config) sets threadpool=shared while the bootstrap application does not define the ShenyuThreadPoolExecutor bean because shenyu.sharedPool.enable is false or absent.

Common situations: User copies a dubbo config example that uses 'shared' threadpool without enabling the shared pool in application.yml; a starter that creates the shared pool isn't on the classpath; config key was renamed or mistyped across versions.

Understand the failure class

Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.

Related errors


AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12). Data as JSON: /api/errors/8e86e813499ac139. Report an issue: GitHub.

Appendix: source

Thrown at shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-dubbo/shenyu-plugin-apache-dubbo/src/main/java/org/apache/shenyu/plugin/apache/dubbo/threadpool/SharedThreadPool.java:38

import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.threadpool.ThreadPool;
import org.apache.shenyu.common.concurrent.ShenyuThreadPoolExecutor;
import org.apache.shenyu.common.exception.ShenyuException;
import org.apache.shenyu.plugin.api.utils.SpringBeanUtils;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;

import java.util.concurrent.Executor;

/**
 * The type Shared Thread Pool.
 */
public class SharedThreadPool implements ThreadPool {
    @Override
    public Executor getExecutor(final URL url) {
        try {
            return SpringBeanUtils.getInstance().getBean(ShenyuThreadPoolExecutor.class);
        } catch (NoSuchBeanDefinitionException t) {
            throw new ShenyuException("shared thread pool is not enable, config ${shenyu.sharedPool.enable} in your xml/yml !", t);
        }
    }
}

View on GitHub (pinned to 567142e072)