apache/seatunnel · error · SeaTunnelEngineException

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

Thrown by FactoryUtil.discoverFactory when more than one SPI-registered factory implements the requested factoryClass with the same factoryIdentifier, making the lookup ambiguous. SeaTunnel refuses to guess and reports all conflicting factory class names in the message.

Source

Thrown at seatunnel-engine/seatunnel-engine-common/src/main/java/org/apache/seatunnel/engine/common/utils/FactoryUtil.java:70

                                                    .equals(factoryIdentifier);
                                        } catch (IllegalAccessException
                                                | InvocationTargetException
                                                | NoSuchMethodException e) {
                                            throw new SeaTunnelEngineException(
                                                    "Failed to call factoryIdentifier method.");
                                        }
                                    })
                            .collect(Collectors.toList());

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

            if (foundFactories.size() > 1) {
                throw new SeaTunnelEngineException(
                        String.format(
                                "Multiple factories for identifier '%s' that implement '%s' found in the classpath.\n\n"
                                        + "Ambiguous factory classes are:\n\n"
                                        + "%s",
                                factoryIdentifier,
                                factoryClass.getName(),
                                foundFactories.stream()
                                        .map(f -> f.getClass().getName())
                                        .sorted()
                                        .collect(Collectors.joining("\n"))));
            }

            return foundFactories.get(0);
        } catch (ServiceConfigurationError e) {
            log.error("Could not load service provider for factories.", e);
            throw new SeaTunnelEngineException("Could not load service provider for factories.", e);
        }
    }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Remove the duplicate connector jar from the connectors directory so only one version providing that identifier remains.
  2. Use --create-param-files / reinstall via install-plugin.sh after wiping stale plugin jars.
  3. Rename your custom factory's factoryIdentifier if it conflicts with a built-in connector.
  4. List the ambiguous classes printed in the exception message and delete/relocate one of them from the classpath.

Example fix

# before
ls connectors/
# connector-jdbc-2.3.3.jar  connector-jdbc-2.3.8.jar
# after
rm connectors/connector-jdbc-2.3.3.jar
Defensive patterns

Strategy: validation

Validate before calling

// before submit: detect duplicate versions
Map<String,List<File>> byName = Files.list(Paths.get("connectors"))
    .collect(Collectors.groupingBy(f -> f.getFileName().toString().replaceAll("-\\d.*","")));
byName.forEach((k,v) -> { if (v.size() > 1) throw new IllegalStateException("duplicate connector: " + k + " " + v); });

Try / catch

try { FactoryUtil.discoverFactory(f, cl, id); } catch (SeaTunnelEngineException e) { log.error("ambiguous factory, clean duplicate jars: {}", e.getMessage()); throw e; }

Prevention

When it happens

Trigger: Calling discoverFactory when two or more jars on the classpath register different factory classes returning the same factoryIdentifier (duplicate plugin versions, e.g. connector-jdbc 2.3.x and 2.3.y both installed).

Common situations: Upgrading a connector by adding the new jar without removing the old one; fat/uber jars embedding another connector's factory; a custom connector shadowing a built-in identifier.

Related errors


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