apache/seatunnel · error · FactoryException

Could not find any factories that implement '%s' in the clas

Error message

Could not find any factories that implement '%s' in the classpath.

What it means

FactoryUtil.discoverFactory throws this FactoryException when the ServiceLoader found no factories at all implementing the requested factory class (e.g. TableSourceFactory) on the classpath. This fires before identifier matching, so it means the entire factory SPI failed to load, not just the requested plugin.

Source

Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/FactoryUtil.java:345

            return Optional.empty();
        }
        final List<T> matchingFactories =
                foundFactories.stream()
                        .filter(f -> f.factoryIdentifier().equalsIgnoreCase(factoryIdentifier))
                        .collect(Collectors.toList());
        if (matchingFactories.isEmpty()) {
            return Optional.empty();
        }
        checkMultipleMatchingFactories(factoryIdentifier, factoryClass, matchingFactories);
        return Optional.of(matchingFactories.get(0));
    }

    public static <T extends Factory> T discoverFactory(
            ClassLoader classLoader, Class<T> factoryClass, String factoryIdentifier) {
        final List<T> foundFactories = discoverFactories(classLoader, factoryClass);

        if (foundFactories.isEmpty()) {
            throw new FactoryException(
                    String.format(
                            "Could not find any factories that implement '%s' in the classpath.",
                            factoryClass.getName()));
        }

        final List<T> matchingFactories =
                foundFactories.stream()
                        .filter(f -> f.factoryIdentifier().equalsIgnoreCase(factoryIdentifier))
                        .collect(Collectors.toList());

        if (matchingFactories.isEmpty()) {
            throw new FactoryException(
                    String.format(
                            "Could not find any factory for identifier '%s' that implements '%s' in the classpath.\n\n"
                                    + "Available factory identifiers are:\n\n"
                                    + "%s",
                            factoryIdentifier,
                            factoryClass.getName(),

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Install the SeaTunnel connectors: sh bin/install-plugin.sh <version>.
  2. Verify META-INF/services/org.apache.seatunnel.api.table.factory.Factory exists inside the connector jar.
  3. Check the classloader passed to discoverFactory actually includes the connector jars.
  4. If building a shaded jar, ensure SPI files are not filtered out by the shade plugin.

Example fix

// before (custom classloader with only app jars)
URLClassLoader cl = new URLClassLoader(new URL[]{appJar});
// after
URLClassLoader cl = new URLClassLoader(new URL[]{appJar, connectorJar}, FactoryUtil.class.getClassLoader());
Defensive patterns

Strategy: validation

Validate before calling

List<Factory> all = FactoryUtil.discoverFactories(classLoader);
if (all.isEmpty()) {
    throw new IllegalStateException("No SeaTunnel factories on classpath; install connectors first");
}

Try / catch

try {
    TableSourceFactory f = FactoryUtil.discoverFactory(cl, TableSourceFactory.class, id);
} catch (FactoryException e) {
    throw new IllegalStateException("Connector jars missing from classpath — run install-plugin.sh", e);
}

Prevention

When it happens

Trigger: Calling discoverFactory(classLoader, TableSourceFactory.class, id) when discoverFactories() returns an empty list — no META-INF/services/org.apache.seatunnel.api.table.factory.Factory resources visible to the classloader.

Common situations: Connector jars not installed in the plugins/connectors directory; fat jar missing SPI service files after shading; custom classloader that excludes SeaTunnel service files; running from an IDE without connector modules on the classpath.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/1deaae6355e58394. Report an issue: GitHub.