{"record":{"id":"0aff3a8081cbc0d9","repo":"apache/druid","slug":"could-not-find-s-on-the-classpath-the-mysql-conn","errorCode":null,"errorMessage":"Could not find %s on the classpath. The MySQL Connector library is not included in the Druid distribution but is required to use MySQL. Please download a compatible library (for example 'mysql-connector-j-8.2.0.jar') and place it under 'extensions/mysql-metadata-storage/'. See https://druid.apache.org/downloads for more details.","messagePattern":"Could not find (.+?) on the classpath\\. The MySQL Connector library is not included in the Druid distribution but is required to use MySQL\\. Please download a compatible library \\(for example 'mysql-connector-j-8\\.2\\.0\\.jar'\\) and place it under 'extensions/mysql-metadata-storage/'\\. See https://druid\\.apache\\.org/downloads for more details\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"extensions-core/mysql-metadata-storage/src/main/java/org/apache/druid/metadata/storage/mysql/MySQLConnector.java","lineNumber":320,"sourceCode":"        // SQL standard unique constraint violation code is 23000 for MySQL\n        if (\"23000\".equals(sqlState)) {\n          return true;\n        }\n      }\n      cause = cause.getCause();\n    }\n    return false;\n  }\n\n  @Nullable\n  private Class<?> tryLoadDriverClass(String className, boolean failIfNotFound)\n  {\n    try {\n      return Class.forName(className, false, getClass().getClassLoader());\n    }\n    catch (ClassNotFoundException e) {\n      if (failIfNotFound) {\n        throw new ISE(e, \"Could not find %s on the classpath. The MySQL Connector library is not included in the Druid \"\n                         + \"distribution but is required to use MySQL. Please download a compatible library (for example \"\n                         + \"'mysql-connector-j-8.2.0.jar') and place it under 'extensions/mysql-metadata-storage/'. See \"\n                         + \"https://druid.apache.org/downloads for more details.\",\n                      className\n        );\n      }\n      log.warn(\"Could not find %s on the classpath.\", className);\n      return null;\n    }\n  }\n}\n","sourceCodeStart":302,"sourceCodeEnd":332,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/mysql-metadata-storage/src/main/java/org/apache/druid/metadata/storage/mysql/MySQLConnector.java#L302-L332","documentation":"MySQLConnector tries to load the configured MySQL driver class via Class.forName; because Oracle licensing excludes the MySQL Connector/J from the Druid distribution, a missing class is a common, expected failure and Druid throws a detailed ISE telling you to download the driver JAR into extensions/mysql-metadata-storage/.","triggerScenarios":"Enabling the mysql-metadata-storage extension without placing a compatible Connector/J JAR (e.g. mysql-connector-j-8.2.0.jar) in the extension directory, then starting Druid with MySQL metadata storage configured.","commonSituations":"Fresh Druid installs where users assume MySQL support is bundled; upgrading Druid and forgetting to re-copy the driver JAR into the new extensions directory; wrong JAR version incompatible with the configured driverClass.","solutions":["Download mysql-connector-j (or matching Connector/J) and place it under extensions/mysql-metadata-storage/","Verify druid.extensions.loadList contains mysql-metadata-storage and the extension directory is on the classpath","If a custom driverClass is set in the config, ensure the JAR actually provides that class"],"exampleFix":"// before\nextensions/mysql-metadata-storage/   # only Druid jars\n// after\nwget https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/8.2.0/mysql-connector-j-8.2.0.jar \\\n  -P extensions/mysql-metadata-storage/","handlingStrategy":"validation","validationCode":"final File extDir = new File(\"extensions/mysql-metadata-storage\");\nif (!Arrays.stream(extDir.listFiles()).anyMatch(f -> f.getName().contains(\"mysql-connector\"))) { throw new IllegalStateException(\"Copy mysql-connector-j JAR into extensions/mysql-metadata-storage/\"); }","typeGuard":null,"tryCatchPattern":"try { connector.init(); } catch (ISE e) { if (e.getMessage().contains(\"Could not find\") && e.getMessage().contains(\"classpath\")) { throw new DeploymentException(\"Install the MySQL Connector/J JAR per Druid docs\"); } throw e; }","preventionTips":["Bundle the driver JAR in your Druid distribution image","Re-copy extension JARs after every Druid upgrade","Match the driverClass config with the JAR version actually shipped"],"tags":["mysql","classpath","driver","extension","missing-dependency"],"backgroundTag":"class-not-found","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}