alibaba/canal · error · IllegalStateException

Error when load extension class(interface: {}, class line: {

Error message

Error when load extension class(interface: {}, class line: {}), class {}is not subtype of interface.

What it means

Error "Error when load extension class(interface: {}, class line: {}), class {}is not subtype of interface." thrown in alibaba/canal.

Source

Thrown at client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/ExtensionLoader.java:341

                            while ((line = reader.readLine()) != null) {
                                final int ci = line.indexOf('#');
                                if (ci >= 0) line = line.substring(0, ci);
                                line = line.trim();
                                if (line.length() > 0) {
                                    try {
                                        String name = null;
                                        int i = line.indexOf('=');
                                        if (i > 0) {
                                            name = line.substring(0, i).trim();
                                            line = line.substring(i + 1).trim();
                                        }
                                        if (line.length() > 0) {
                                            Class<?> clazz = classLoader.loadClass(line);
                                            // Class<?> clazz =
                                            // Class.forName(line, true,
                                            // classLoader);
                                            if (!type.isAssignableFrom(clazz)) {
                                                throw new IllegalStateException(
                                                        "Error when load extension class(interface: " + type
                                                                + ", class line: " + clazz.getName()
                                                                + "), class " + clazz.getName()
                                                                + "is not subtype of interface.");
                                            } else {
                                                try {
                                                    clazz.getConstructor(type);
                                                } catch (NoSuchMethodException e) {
                                                    clazz.getConstructor();
                                                    String[] names = NAME_SEPARATOR.split(name);
                                                    if (names != null && names.length > 0) {
                                                        for (String n : names) {
                                                            if (!cachedNames.containsKey(clazz)) {
                                                                cachedNames.put(clazz, n);
                                                            }
                                                            Class<?> c = extensionClasses.get(n);
                                                            if (c == null) {
                                                                extensionClasses.put(n, clazz);

View on GitHub (pinned to 87be50e876)

Solutions

  1. Make the extension class implement the declared extension interface.
  2. Fix the SPI resource file entry so the listed class matches the expected interface.

When it happens

Trigger: Thrown at client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/ExtensionLoader.java:341 when the library encounters an invalid state.

Common situations: Extension class does not implement its SPI interface. Validate assignability before registration and skip the offending line with a clear message naming file and class.


AI-assisted analysis of alibaba/canal@87be50e876 (2026-08-14). Data as JSON: /api/errors/07cfc757f3d41864. Report an issue: GitHub.