t8y2/dbx · error · IllegalArgumentException
No JDBC driver was discovered. Enter the driver class name…
Error message
No JDBC driver was discovered. Enter the driver class name for this JAR.
What it means
Thrown by registerDrivers in DbxJdbcPlugin after scanning a supplied JAR for JDBC driver classes: no class implementing java.sql.Driver was found or loadable, so the plugin cannot register anything. The plugin parses JARs, inspects META-INF/services/java.sql.Driver and candidate classes, and wraps them in a shim; if `loaded` stays false while JAR URLs exist, it fails fast with this IllegalArgumentException instead of failing later at connect time.
Solutions
- Verify the JAR is the actual JDBC driver artifact (e.g. postgresql-42.x.jar, ojdbc11.jar) and the file path/URL is correct and readable.
- Open the JAR and check META-INF/services/java.sql.Driver exists listing the driver class; if missing, add the services entry or use the vendor's official driver JAR.
- Since the message says to enter the driver class name, supply the fully-qualified driver class explicitly (e.g. org.postgresql.Driver) via the plugin's driver-class option.
- Run on a JDK version compatible with the driver's class-file version and ensure all of the driver's dependency JARs are on the classpath.
Example fix
// before jarPath = "/libs/hikariCP.jar"; // connection pool, not a driver registerDrivers(List.of(jarPath), null); // after jarPath = "/libs/postgresql-42.7.3.jar"; // actual driver jar registerDrivers(List.of(jarPath), "org.postgresql.Driver"); // explicit class
Defensive patterns
Strategy: validation
Validate before calling
// Java: verify jar is a driver jar before registering
boolean isDriverJar(Path jar) throws IOException {
try (var zf = new java.util.zip.ZipFile(jar.toFile())) {
return zf.getEntry("META-INF/services/java.sql.Driver") != null;
}
}
if (!isDriverJar(Path.of(jarPath))) throw new IllegalStateException(jarPath + " has no java.sql.Driver service entry"); Prevention
- Only ship official vendor driver JARs, not repackaged/shaded copies
- Check META-INF/services/java.sql.Driver exists in every driver jar you deploy
- Provide the driver class name explicitly when JAR discovery is ambiguous
- Keep JDK version compatible with the driver's target Java version
When it happens
Trigger: Calling the plugin's driver-registration flow (via handleLine) with a JAR path that contains no JDBC Driver implementation, a shaded/obfuscated driver whose services file was stripped, or a JAR whose driver class fails to load/instantiate (missing dependencies, wrong Java bytecode version).
Common situations: Pointing at the wrong JAR (e.g. a driver's non-driver companion jar), fat-jar repackaging that dropped META-INF/services entries, a driver compiled for a newer JDK than the runtime, or a JAR URL typo (file not found produces no discoverable driver).
Related errors
- A manual transaction is already active
- Agent runtime JDBC physical connection limit reached
- Bundled H2 driver is missing: " + version.resourcePath()
- Completion assistant search is not supported by this agent
- Connection failed
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/ce03a59bfa18cd37.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java:620
Driver driver = (Driver) constructor.newInstance();
registeredDriver = new DriverShim(driver);
DriverManager.registerDriver(registeredDriver);
registeredDriverKey = driverKey;
return;
}
boolean loaded = false;
Driver first = null;
for (Driver driver : ServiceLoader.load(Driver.class, loader)) {
Driver shim = new DriverShim(driver);
if (first == null) {
first = shim;
}
DriverManager.registerDriver(shim);
loaded = true;
}
if (!loaded && !urls.isEmpty()) {
throw new IllegalArgumentException("No JDBC driver was discovered. Enter the driver class name for this JAR.");
}
registeredDriver = first;
registeredDriverKey = driverKey;
}
private static Connection openConnection(JsonNode connection) throws SQLException {
String url = jdbcUrl(connection);
if (url == null) {
throw new IllegalArgumentException("JDBC URL is required.");
}
String key = connectionKey(connection);
if (sharedConnection != null && key.equals(sharedConnectionKey) && !isConnectionClosed(sharedConnection)) {
configureOrdinaryAutoCommit(sharedConnection);
return sharedConnection;
}
closeSharedConnection();
JdbcUrlCredentials urlCredentials = extractJdbcUrlCredentials(url);View on GitHub (pinned to c0390bff16)