{"record":{"id":"e879e4757b906e72","repo":"apache/beam","slug":"unable-to-resolve-class-s-to-use-as-debezium-connector","errorCode":null,"errorMessage":"Unable to resolve class %s to use as Debezium connector.","messagePattern":"Unable to resolve class (.+?) to use as Debezium connector\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/debezium/src/main/java/org/apache/beam/io/debezium/Connectors.java","lineNumber":50,"sourceCode":"  private final String connector;\n\n  Connectors(String name, String connector) {\n    this.name = name;\n    this.connector = connector;\n  }\n\n  /** The name of this connector class. */\n  public String getName() {\n    return name;\n  }\n\n  /** Class connector to debezium. */\n  public @NonNull Class<? extends SourceConnector> getConnector() {\n    Class<? extends SourceConnector> connectorClass = null;\n    try {\n      connectorClass = (Class<? extends SourceConnector>) Class.forName(this.connector);\n    } catch (ClassCastException | ClassNotFoundException e) {\n      throw new IllegalArgumentException(\n          String.format(\n              \"Unable to resolve class %s to use as Debezium connector.\", this.connector));\n    }\n    return connectorClass;\n  }\n\n  /**\n   * Returns a connector class corresponding to the given connector name.\n   *\n   * @param connectorName The name of the connector. Ex.: MySQL\n   * @return Connector enum representing the given connector name.\n   */\n  public static Connectors fromName(String connectorName) {\n    for (Connectors connector : Connectors.values()) {\n      if (connector.getName().equals(connectorName)) {\n        return connector;\n      }\n    }","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/debezium/src/main/java/org/apache/beam/io/debezium/Connectors.java#L32-L68","documentation":"Connectors.getConnector() reflectively loads the configured Debezium connector class by fully-qualified name via Class.forName. If the name is misspelled or the connector artifact is not on the classpath, it throws IllegalArgumentException. Note the catch also handles ClassCastException from the unchecked cast.","triggerScenarios":"Passing a connector class name (e.g. via 'connector.class' config) that does not exist on the classpath or is not a subclass of org.apache.kafka.connect.source.SourceConnector.","commonSituations":"Typos in the fully-qualified class name, forgetting to bundle the Debezium connector dependency (e.g. debezium-mysql-connector) into the pipeline jar, or using a class that implements a different Connector interface version.","solutions":["Verify the fully-qualified class name (e.g. io.debezium.connector.mysql.MySqlConnector) is spelled exactly.","Add the corresponding Debezium connector artifact to the build and ensure it is shaded/bundled into the job jar.","Confirm the class extends org.apache.kafka.connect.source.SourceConnector, matching your Kafka Connect API version.","Test Class.forName(name) locally in the same classpath as the pipeline."],"exampleFix":"// before\n.withConnector(\"io.debezium.connector.mysql.MySQLConnector\") // wrong case -> ClassNotFoundException\n// after\n.withConnector(\"io.debezium.connector.mysql.MySqlConnector\")\n// and in build.gradle: implementation 'io.debezium:debezium-connector-mysql:2.x'","handlingStrategy":"validation","validationCode":"try {\n  Class.forName(\"io.debezium.connector.mysql.MySqlConnector\", false, Thread.currentThread().getContextClassLoader());\n} catch (ClassNotFoundException e) {\n  throw new IllegalStateException(\"Debezium connector class missing from classpath: add the connector artifact\");\n}","typeGuard":"static boolean validConnectorName(String name) {\n  return name != null && name.startsWith(\"io.debezium.connector.\") && name.endsWith(\"Connector\");\n}","tryCatchPattern":null,"preventionTips":["Copy fully-qualified class names exactly from Debezium docs (mind case).","Ensure the connector artifact is bundled/shaded into the job jar, not just compile-time.","Verify the class implements SourceConnector from the Kafka Connect version on the pipeline classpath."],"tags":["java","apache-beam","debezium","classpath","reflection"],"backgroundTag":"class-not-found","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}