You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Apache Zeppelin报ava.lang.ClassNotFoundException: com.mysql.jdbc.Driver错误求助

Fixing java.lang.ClassNotFoundException: com.mysql.jdbc.Driver in Apache Zeppelin

Got it, let's break down why you're running into this error and walk through the fixes step by step.

First, looking at your interpreter config, there are two key issues that are causing the driver not to be found:

1. Typo in the Driver Class Name

Your default.driver is set to org.mysql.jdbc.Driver – but the correct fully qualified class name for MySQL 5.x connectors is com.mysql.jdbc.Driver. The org prefix here is a mistake that's preventing Zeppelin from locating the driver class.

2. Incorrect Dependency Configuration

The Dependencies line uses exclude, which tells Zeppelin to ignore the specified JAR file. But we need Zeppelin to include this driver JAR to connect to MySQL. Plus, the syntax for referencing a local JAR is off when using exclude.


Step-by-Step Solutions

Correct the Driver Class

  1. Open your Zeppelin UI and navigate to the Interpreter page.
  2. Find the JDBC interpreter and edit its settings.
  3. Locate the default.driver property and update its value to:
    com.mysql.jdbc.Driver
    
    (Note: If you were using MySQL 8.0+, this would be com.mysql.cj.jdbc.Driver, but since your connector is 5.1.46, stick with the above.)

Fix the Dependency Setup

You have two options here, pick whichever works better for you:

Option A: Use Maven Artifact (Recommended)

Instead of relying on a local JAR, let Zeppelin handle downloading the driver via Maven. Update the Dependencies field to:

mysql:mysql-connector-java:5.1.46

Zeppelin will automatically fetch this artifact and its dependencies if they aren't already in your local repo.

Option B: Use Your Local JAR

If you want to use the existing JAR at /usr/local/zeppelin/interpreter/jdbc/mysql-connector-java-5.1.46-bin.jar, change the Dependencies line to just:

/usr/local/zeppelin/interpreter/jdbc/mysql-connector-java-5.1.46-bin.jar

Remove the exclude keyword entirely. Also, double-check that the JAR exists at that path and that the Zeppelin process has read permissions for it.

Restart the Interpreter

After making these changes, save the interpreter settings and restart the JDBC interpreter. This ensures the new config and driver are loaded properly.


Additional Checks

  • Test if you can connect to MySQL from the Zeppelin server using the same credentials: Run mysql -u root -p in the terminal and enter your password. If this fails, fix the MySQL connection first before troubleshooting Zeppelin.
  • Ensure your default.url is complete (it should include the database name, e.g., jdbc:mysql://localhost:3306/your_database_name – without the database name, you might hit connection issues even after fixing the driver).

Once you've applied these fixes, try running your JDBC note again – the ClassNotFoundException should be resolved.

内容的提问来源于stack exchange,提问作者immortal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 08:22:14